computePcaSample: Principal Components Analysis

Description Usage Arguments Details Value See Also Examples

View source: R/sampleCompute.R

Description

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

Usage

1
2
3
4
5
6
7
8
computePcaSample(
  data.sample,
  pca.nb.dims = 0,
  selected.var = NULL,
  echo = F,
  prcomp.options = list(center = T, scale = T),
  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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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, dir.save=tempdir())

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 Feb. 4, 2020, 5:08 p.m.