Skip to contents

This function uses a group, PCA variables, and a 'scaled' boolean to generate a biplot using 'ggplot2' and 'scico'.

If scaled is set to TRUE, variables will not be scaled. If scaled is set to FALSE, variables will be scaled.

Usage

pca_plot(group, pcavars, scaled = FALSE, palette = "oslo")

Arguments

group

The group variable (column)

pcavars

The variables to include in the principle component analysis

scaled

A boolean (TRUE or FALSE) indicating if the pcavars are already scaled

palette

A color palette to use on the plot, with each group assigned to a color.

Value

A plot showing PC1 on the x axis, PC2 on the y axis, colored by group, with vectors and labels showing the individual pca variables.

Examples

pca_plot(iris$Species, iris[,c(1:4)])


pca_plot(iris$Species, iris[,c(1:4)], FALSE, "bilbao")