Learn R Programming

RFmarkerDetector (version 1.0.1)

pca: Principal Component Analysis

Description

Performs a principal component analysis based on Singular Value Decomposition, on the given data matrix and returns the result as an object of the S3 class pca

Usage

pca(X, autoscale = T, exclude = T)

Arguments

X
a n x p data frame of n observations and p variables.
autoscale
a logical value indicating whether the variables should be autoscaled
exclude
a logical value indicating whether the first two columns should be excluded from the computation. The default is TRUE, because usually the first two columns of the dataset processed represent respectively the sample names and the class labels associated with the samples

Value

an S3 object of class pca with the following components:
  • scores the scores matrix
  • loadings the loading matrix
  • variances the vector of variances explained by each PC
  • classes the vector of the class labels associated with the samples
  • features the vector with the names of the input variables

Examples

Run this code
data(cachexiaData)
pca_obj <- pca(cachexiaData, autoscale = TRUE, exclude = TRUE)

Run the code above in your browser using DataLab