Created
April 26, 2020 22:28
-
-
Save sneakers-the-rat/e53952a6321a2f4504495f41ab2cb71a to your computer and use it in GitHub Desktop.
pasta types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(factoextra) | |
# length/diameter - cm, diameter is major | |
# eccentricity - minor/major | |
# pitch - turns/cm | |
# toroidal, corrugated - boolean | |
# envelope - boolean - diameter deviation longitudinally, | |
pasta <- tribble( | |
~name, ~length, ~diameter, ~eccentricity, ~pitch, ~toroidal, ~corrugated, ~envelope, | |
"Bucatini", 25, 0.4, 1, 0, 1, 0, 0, | |
"Busiate", 5, 0.6, 1, 1, 0, 0, 0, | |
"Capellini", 25, 0.085, 1, 0, 0, 0, 0, | |
"Angel Hair", 25, 0.078, 1, 0, 0, 0, 0, | |
"Fettuccine", 25, 0.65, 0.2, 0, 0, 0, 0, | |
"Linguine" , 25, 0.4, 0.3, 0, 0, 0, 0, | |
"Lasagne" , 15, 6, 0.05, 0, 0, 1, 0, | |
"Lasagnette", 15, 4, 0.07, 0, 0, 1, 0, | |
"Maccheroni", 50, 0.6, 1, 0, 0, 0, 0, | |
"Mafaldine", 25, 1, 0.2, 0, 0, 1, 0, | |
"Penne" , 5, 1, 1, 0, 1, 1, 0, | |
"Spaghetti", 25, .2, 1, 0, 0, 0, 0, | |
"Ziti" , 25, 1.5, 1, 0, 1, 1, 0, | |
"Calamarata", 1, 2, 1, 0, 1, 0, 0, | |
"Campanelle", 2, 1, 0.2, 2, 0, 0, 0, | |
"Cavatappi", 3, 0.5, 1, 1, 1, 1, 0, | |
"Conchiglie", 1.5, 1, 0.2, 0, 0, 1, 1, | |
"Farfalle" , 3, 2.5, 0.1, 0, 0, 1, 1, | |
"Cannelloni", 10, 2.5, 1, 0, 0, 0, 0, | |
"Fusilli", 4, 1, 0.2, 3, 0, 0, 0, | |
"Macaroni", 3, 0.3, 1, 0, 1, 0, 0, | |
"Rigatoni", 4, 2, 1, 0, 1, 1, 0, | |
"Orzo" , 1, 0.3, 1, 0, 0, 0, 1, | |
"Rotini", 4, 1, 0.2, 6, 0, 0, 0 | |
) | |
pasta <- as.data.frame(pasta) | |
rownames(pasta) <- pasta$name | |
pasta <- pasta[,2:ncol(pasta)] | |
pasta_pca <- prcomp(pasta, scale=TRUE) | |
fviz_pca_ind(pasta_pca, repel=TRUE, | |
col.ind="cos2") | |
fviz_pca_var(pasta_pca, | |
col.var = "contrib", | |
repel=TRUE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment