NPT: Perform nested principal component analysis (PCA of PCAs) for...

View source: R/NPT.R

NPTR Documentation

Perform nested principal component analysis (PCA of PCAs) for ecological niche periodicity

Description

This function conducts a ‘PCA of PCAs’ to analyze ecological niche periodicity based on multiple trait dimensions.

Usage

NPT(data, dimension)

Arguments

data

A data frame containing species trait data.

dimension

A list of character vectors, each representing a trait dimension with corresponding column names from the data.

Details

The function performs the following steps:

  1. Checks and cleans input data, removing rows with NA values

  2. Conducts first-level PCA for each trait dimension

  3. Extracts PC1 and PC2 scores from each first-level PCA

  4. Combines all PC scores and performs a second-level PCA

  5. Returns summary statistics and results from both levels of analysis

Value

A list containing three elements:

PCA_first

A data frame summarizing the first-level PCA results for each dimension

PCA_second

A matrix of species scores from the second-level PCA

result

The complete rda object from the second-level PCA

References

  1. Winemiller, K. O., Fitzgerald, D. B., Bower, L. M., & Pianka, E. R. (2015). Functional traits, convergent evolution, and periodic tables of niches. Ecology letters, 18(8), 737-751. https://doi.org/10.1111/ele.12462

  2. Yu, R., Huang, J., Xu, Y., Ding, Y., & Zang, R. (2020). Plant functional niches in forests across four climatic zones: Exploring the periodic table of niches based on plant functional traits. Frontiers in Plant Science, 11, 841. https://doi.org/10.3389/fpls.2020.00841

Examples

data(PFF)
PFF[,3:20] <- log(PFF[,3:20])
traits_dimension <- list(
  grow = c("SLA","Leaf_area","LDMC","SRL","Leaf_Nmass","Leaf_Pmass","Root_Nmass"),
  survive = c("Height","Leaf_Cmass","Root_Cmass","Leaf_CN","Leaf_NP","Leaf_CP","Root_CN"),
  reproductive = c("SeedMass","FltDate","FltDur")
)
result <- NPT(data = PFF, dimension = traits_dimension)
result


MultiTraits documentation built on April 16, 2025, 9:07 a.m.