biplot: Flexibly generate a biplot from the output of a PCA

View source: R/biplot.R

biplotR Documentation

Flexibly generate a biplot from the output of a PCA

Description

Given the output of a PCA, makes biplot of data showing the magnitude of the factor loadings that contribute the plotted PCs.

Usage

biplot(pca, top.n, data, color, base_only)

Arguments

pca

The output of 'prcomp()' on the data to be ordinated.

top.n

The number of loadings to plot (ranked by descending magnitude). Default 5

data

A 'data.frame' of sample metadata variables row names matching those in the PCA output.

color

The sample metadata variable (a column in provided 'data') by which to color plotted points. Taken as a string (i.e. 'subj')

base_only

Should only the base PCA be returned, without loadings? Default FALSE

Value

A ggplot object


ammararuby/MButils documentation built on Jan. 29, 2023, 11:13 a.m.