Learn R Programming

tidyspec (version 0.1.0)

spec_pca_wn_contrib: Compute Wavenumber Contributions to Principal Components

Description

This function calculates the contribution of each wavenumber to the principal components (PCs) in a PCA result. Contributions are computed as the squared loadings multiplied by 100.

This function calculates the contribution of each wavenumber to the principal components (PCs) in a PCA result. Contributions are computed as the squared loadings multiplied by 100.

Usage

spec_pca_wn_contrib(PCA)

spec_pca_wn_contrib(PCA)

Value

A tibble containing the wavenumber column and the percentage contribution of each wavenumber to each principal component.

A tibble containing the wavenumber column and the percentage contribution of each wavenumber to each principal component.

Arguments

PCA

An object of class `prcomp`, containing the results of a principal component analysis.

Details

The function extracts the PCA loadings (rotation matrix) and computes the squared values of each loading, scaled to percentage values. This helps interpret the importance of each wavenumber in defining the principal components.

The function extracts the PCA loadings (rotation matrix) and computes the squared values of each loading, scaled to percentage values. This helps interpret the importance of each wavenumber in defining the principal components.

Examples

Run this code
# \donttest{
pca_result <- spec_pca(CoHAspec)
wn_contrib <- spec_pca_wn_contrib(pca_result)
print(wn_contrib)
# }

# \donttest{
pca_result <- spec_pca(CoHAspec)
wn_contrib <- spec_pca_wn_contrib(pca_result)
print(wn_contrib)
# }

Run the code above in your browser using DataLab