Learn R Programming

PNC (version 0.1.0)

compnc: Calculate Phylogenetic Niche Conservatism Across Multiple Communities

Description

This function conducts comprehensive phylogenetic niche conservatism analysis across multiple communities simultaneously. It evaluates phylogenetic signal for trait data across different community assemblages using various statistical methods, enabling comparative assessment of niche conservatism patterns among communities. The function processes community composition matrices, species trait information, and phylogenetic trees to determine whether closely related species consistently occupy similar ecological niches across different habitats or sampling locations.

Usage

compnc(
  com,
  trait_data,
  phylo_tree,
  methods = c("lambda", "K"),
  pca_axes = c("PC1", "PC2"),
  sig_levels = c(0.001, 0.01, 0.05),
  min_abundance = 0,
  nsim = 1000,
  verbose = TRUE
)

Value

A data frame containing phylogenetic signal results for all communities

Arguments

com

A community matrix with sites as rows and species as columns

trait_data

A data frame or matrix containing trait data with species as rows

phylo_tree

A phylogenetic tree object of class "phylo"

methods

Character vector specifying methods to use. Options: "lambda", "K"

pca_axes

Character vector specifying which PCA axes to include (e.g., c("PC1", "PC2"))

sig_levels

Numeric vector of significance levels for marking results

min_abundance

Minimum abundance threshold for including species

nsim

Number of permutations for significance testing

verbose

Logical indicating whether to show progress and warnings

Examples

Run this code
# \donttest{
#' # Load example data
data(BCI)
data(TRY)

# Extract trait data
sp <- colnames(BCI$com)
subtraits <- extract_traits(sp, TRY, rank = "species",
                           traits = c("LA", "LMA", "LeafN", "PlantHeight", "SeedMass", "SSD"))

compnc(com = BCI$com, subtraits, BCI$phy_species, methods = "lambda", pca_axes = NULL)
# }

Run the code above in your browser using DataLab