spec_pca {tidyspec}R Documentation

Perform Principal Component Analysis (PCA) on Spectral Data

Description

This function computes a Principal Component Analysis (PCA) on spectral data, excluding the wavenumber column from the analysis.

Usage

spec_pca(.data, wn_col = NULL, scale = TRUE, center = TRUE)

Arguments

.data

A data frame containing spectral data, with one column representing wavenumbers and the remaining columns containing spectral intensity values.

wn_col

A string specifying the name of the column that contains the wavenumber values. If NULL, the function attempts to retrieve the default wavenumber column set by 'set_spec_wn()'.

scale

A logical value indicating whether the spectral data should be scaled (default is TRUE).

center

A logical value indicating whether the spectral data should be centered (default is TRUE).

Value

A 'prcomp' object containing the PCA results, including principal components, standard deviations, and loadings.

Examples


set_spec_wn("Wavenumber")
pca_result <- spec_pca(CoHAspec)
summary(pca_result)



[Package tidyspec version 0.1.0 Index]