computePcaSample: Principal Components Analysis

View source: R/sampleCompute.R

computePcaSampleR Documentation

Principal Components Analysis

Description

Perform Principal Components Analysis, dealing with the number of dimensions, automatically or not.

Usage

computePcaSample(
  data.sample,
  pca.nb.dims = 0,
  selected.var = NULL,
  echo = FALSE,
  prcomp.options = list(center = TRUE, scale = TRUE),
  pca.variance.cum.min = 0.95
)

Arguments

data.sample

list containing features, profiles and clustering results.

pca.nb.dims

number of dimensions to keep after PCA. If pca.nb.dims=0 (default), this number is automatically computed.

selected.var

vector of features names to consider for the PCA.

echo

boolean: if FALSE (default), no description printed in the console.

prcomp.options

list of default parameters values for the function prcomp.

pca.variance.cum.min

minimal cumulative variance to retain in PCA.

Details

computePcaSample performs Principal Components Analysis, dealing with the number of dimensions, automatically or not

Value

features list containing the results of PCA, returned by prcomp.

See Also

computeSpectralEmbeddingSample

Examples

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 <- computePcaSample(x, echo = TRUE)

plot(res$pca_full$x[,1], res$pca_full$x[,2], main="PCA", xlab="PC1", ylab="PC2")



RclusTool documentation built on May 29, 2024, 5:23 a.m.