View source: R/sampleCompute.R
computePcaNbDims | R Documentation |
Compute the number of dimensions to keep after a Principal Components Analysis, according to a threshold on the cumulative variance.
computePcaNbDims(sdev, pca.variance.cum.min = 0.9)
sdev |
standard deviation of the principal components (returned from prcomp). |
pca.variance.cum.min |
minimal cumulative variance to retain. |
computePcaNbDims computes the number of dimensions to keep after a Principal Components Analysis, according to a threshold on the cumulative variance
pca.nb.dims number of dimensions kept.
computePcaSample
dat <- rbind(matrix(rnorm(100, mean = 0, sd = 0.3), ncol = 2),
matrix(rnorm(100, mean = 2, sd = 0.3), ncol = 2),
matrix(rnorm(100, mean = 4, sd = 0.3), ncol = 2))
tf <- tempfile()
write.table(dat, tf, sep=",", dec=".")
x <- importSample(file.features=tf)
res.pca <- computePcaSample(x)
computePcaNbDims(res.pca$pca$sdev)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.