getPcaVars: Calculates the percent of variance explained for principal...

View source: R/getPcaVars.R

getPcaVarsR Documentation

Calculates the percent of variance explained for principal components

Description

Given a PCA object created with prcomp, this function computes the percent of variance explained by each of the principal components.

Usage

getPcaVars(pca, digits = 3)

Arguments

pca

An object created with prcomp.

digits

The number of significant digits to round to.

Value

A vector with the percent of variance explained for each of the principal components in decreasing order.

Author(s)

Andrew E Jaffe

Examples


pca <- prcomp(USArrests)
getPcaVars(pca)

LieberInstitute/jaffelab documentation built on Dec. 15, 2024, 10:44 p.m.