ggscree | R Documentation |
Takes a PCA object returned by prcomp()
, extracts
the standard deviations of the principal components (PC), and
plots these against the PC number. The guidance line assumes that
all of the variables have been standardised prior to PCA.
ggscree(pc, q = 2, guide = TRUE, cumulative = FALSE)
pc |
PCA object |
q |
number of principal components to show, default 2 (you should change) |
guide |
logical whether to compute and add a typical value of the variance, if the data was full-dimensional |
cumulative |
logical whether to draw cumulative variance |
scree a ggplot object
data(aflw)
aflw_std <- apply(aflw[,7:35], 2, function(x)
(x-mean(x, na.rm=TRUE))/
sd(x, na.rm=TRUE))
aflw_pca <- prcomp(aflw_std[,c("goals","behinds",
"kicks","disposals")])
ggscree(aflw_pca, q=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.