plot_pca: Principal Component Analysis biplot

View source: R/plot_pca.R

plot_pcaR Documentation

Principal Component Analysis biplot

Description

Performs a PCA on the tracer data and displays a biplot with source group ellipses. Averaged datasets (with Mean_/SD_ or mean_/sd_ columns) are automatically expanded to individual observations by sampling from a normal distribution before the PCA is computed, so all formats are accepted.

Usage

plot_pca(data, components = c(1L, 2L), colors = NULL, seed = NULL)

PCAPlot(data, components = c(1L, 2L), colors = NULL, seed = NULL)

PCA_plot(data, components = c(1L, 2L), colors = NULL, seed = NULL)

Arguments

data

A data frame containing source and mixture data in the standard fingerprinting format (raw or averaged).

components

A numeric vector of length 2 indicating which principal components to display. Default c(1, 2).

colors

An optional character vector of colors, one per group. If NULL, ggplot2 defaults are used.

seed

An integer value used to initialize the random number generator.

Value

A ggplot object (also printed to the active graphics device).


OceanTracer documentation built on Oct. 15, 2026, 5:09 p.m.