pcaR2: Calculate R-squared for a matrix or principal components

Description Usage Arguments Details

View source: R/pcaR2plot.R

Description

Calculate the fraction of variance explained by a predictor (numerical or factor) for each of the columns in a matrix or for each principal component in a prcomp object.

Usage

1
2
3
4
pcaR2(x, predictor, randomize = 0, comps = NULL, scaled = FALSE)

## S3 method for class 'pcaR2'
plot(x, ...)

Arguments

x

a numeric matrix or object of class prcomp

predictor

a factor or a numeric vector

randomize

how many randomizations should be run

comps

for which PCA components (or for which columns of the numeric matrix) the correlations should be calculated

scaled

whether the data should be scaled

Details

Calculate the fraction of variance explained by a predictor (numerical or factor) for each of the columns in a matrix or for each principal component in a prcomp object.


january3/myfuncs documentation built on April 1, 2020, 4:42 a.m.