pca_plot: Principal Component Analysis Plot

View source: R/ztils.R

pca_plotR Documentation

Principal Component Analysis Plot

Description

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

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")

ztils documentation built on April 11, 2025, 5:52 p.m.