Builds axis labels for plot_process_pca() from a terrain_pca() object.
Usage
pca_axis_labels(
pca,
components = c("PC1", "PC2"),
top_n = 2,
unique = TRUE,
include_variance = TRUE
)Arguments
- pca
Output from
terrain_pca().- components
Components to label.
- top_n
Number of high-loading variables included per component.
- unique
Logical. Avoid repeating the same dominant variable across component labels when possible.
- include_variance
Logical. Include percent variance explained.
Details
Variables are ranked by absolute loading for each component. These labels are descriptive aids for ordination plots; they do not replace inspection of the full loading table.
Examples
df <- data.frame(a = rnorm(10), b = rnorm(10), c = rnorm(10))
pca_axis_labels(terrain_pca(df))
#> PC1 PC2
#> "PC1 (60.2%; a, c)" "PC2 (30.6%; b, c)"
