pca_data: Principal Component Analysis Data

View source: R/ztils.R

pca_dataR Documentation

Principal Component Analysis Data

Description

This function uses a dataframe, PCA variables, and a scaled boolean to generate a dataframe with principal components as columns.

Usage

pca_data(data, pcavars, scaled = FALSE)

Arguments

data

The dataframe to add principal components to.

pcavars

The variables to include in the principle component analysis

scaled

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

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_data(iris, iris[,c(1:4)], FALSE)

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