pca: Generic Function for Principal Component Analysis

View source: R/generic_functions.R

pcaR Documentation

Generic Function for Principal Component Analysis

Description

This is a generic function to call PCA on various objects. The default method uses stats::prcomp().

Usage

pca(object, TVE = 1, ...)

## Default S3 method:
pca(object, ...)

## S3 method for class 'dfts'
pca(object, TVE = 1, ...)

Arguments

object

Object for computation of principle components analysis.

TVE

Numeric in [0,1] for the total variance explained, this determines the number of components and can be used for dimension reduction.

...

Additional parameters to extensions based on data. Often this is additional information for prcomp.

Value

Principal component data. Note that the scores are in x and the eigenfuctions in rotation. This is to keep consistency between existing pca methods in R, but may change in the future.

Examples

pca(1:10)
pca(electricity)

fChange documentation built on June 21, 2025, 9:08 a.m.