expVar: S3 function expVar to extract explained variance from prcomp...

View source: R/expVar.R

expVarR Documentation

S3 function expVar to extract explained variance from prcomp and PCAScoreMatrix objects

Description

S3 function expVar to extract explained variance from prcomp and PCAScoreMatrix objects

Usage

expVar(x, choices)

## S3 method for class 'prcomp'
expVar(x, choices)

## S3 method for class 'PCAScoreMatrix'
expVar(x, choices)

Arguments

x

A prcomp or PCAScoreMatrix object.

choices

Either missing, or an integer vector of indices, indicating which PCs should be returned.

Value

A numeric vector of variance explained

Methods (by class)

  • expVar(prcomp): Extract explained variance from a prcomp object

  • expVar(PCAScoreMatrix): Extract explained variance from a PCAScoreMatrix object

Methods (by class)

  • prcomp: Extract explained variance from a prcomp object

  • PCAScoreMatrix: Extract explained variance from a PCAScoreMatrix object

Examples


myMat <- matrix(rnorm(100), ncol=10)
myPrcomp <- prcomp(myMat)
myPcaScoreMatrix <- pcaScores(myPrcomp, choices=NULL) 
expVar(myPrcomp)
expVar(myPcaScoreMatrix)

expVar(myPrcomp, 1:5)
expVar(myPcaScoreMatrix, 1:5)


bedapub/ribiosPlot documentation built on Sept. 1, 2023, 6:50 p.m.