pca_analysis_dataset: Auto-exported function: pca_analysis_dataset

View source: R/pca.R

pca_analysis_datasetR Documentation

Auto-exported function: pca_analysis_dataset

Description

Auto-exported function: pca_analysis_dataset

Usage

pca_analysis_dataset(
  dataset,
  scale = TRUE,
  center = TRUE,
  write.file = FALSE,
  file.out = NULL,
  ...
)

Arguments

dataset

Dataset to analyse.

scale

Logical indicating whether variables should be scaled.

center

Logical indicating whether variables should be centered.

write.file

Logical indicating whether scores and loadings should be written to files.

file.out

Output file prefix used when write.file = TRUE.

...

Additional arguments passed to prcomp().

Value

An object of class prcomp containing PCA results. The x component stores sample scores and the rotation component stores variable loadings.

Examples

datamat <- matrix(
  rnorm(20),
  nrow = 4,
  dimnames = list(paste0("x", 1:4), paste0("s", 1:5))
)
metadata <- data.frame(class = factor(c("A", "A", "B", "B", "A")))
dataset <- list(data = datamat, metadata = metadata)
pca_res <- pca_analysis_dataset(dataset)


specmine documentation built on Aug. 5, 2026, 5:06 p.m.