Calculates the rate of accumulation of phylogenetic diversity (CpD) over time slices
Source:R/CpD.R
CpD.Rd
This function estimates the rates of accumulation of phylogenetic diveristy (CpD) over time for inputted assemblages.
Arguments
- tree
phylo. An ultrametric phylogenetic tree in the "phylo" format.
- n
numeric. A numeric value indicating the number of temporal slices (method = 1) or the time interval in million years (or phylogenetic diversity) among the tree slices (method = 2). Default is 1.
- mat
matrix. A presence/absence matrix containing all studied species and sites.
- criterion
character string. The method for cutting the tree. It can be either "my" (million years) or "PD" (accumulated phylogenetic diversity). Default is "my".
- pDO
numeric. A value indicating the numeric proportion to define the temporal origin at which the phylogenetic diversity (PD) started to accumulate in a given assemblage. Default is 5%.
- ncor
numeric. A value indicating the number of cores the user wants to parallelize. Default is 0.
Value
The function returns a data frame containing the assemblages' rates of cumulative phylogenetic diversity (CpD), their total phylogenetic diversity (PD), and their PD origin (pDO).
Details
Parallelization
Users are advised to check the number of available cores within their machines before running parallel programming.
Author
Matheus Lima de Araujo matheusaraujolima@live.com
Examples
# Generate a random tree
tree <- ape::rcoal(20)
# Create a presence-absence matrix
mat <- matrix(sample(c(1,0), 20*10, replace = TRUE), ncol = 20, nrow = 10)
colnames(mat) <- tree$tip.label
# Calculate the CpD for 100 tree slices
CpD(tree, n = 100, mat = mat)
#> > The 100 number of pieces inputted equals to intervals of 0.0100617206504046 million of years.
#> CpD PD pDO
#> 1 1.728948 2.438110 1.732691
#> 2 1.597088 2.158985 1.875746
#> 3 1.734865 2.406693 1.726781
#> 4 1.728948 2.438110 1.732691
#> 5 2.273012 1.780403 1.317957
#> 6 1.881951 2.643324 1.591823
#> 7 1.638289 2.170911 1.828574
#> 8 1.626118 2.116416 1.842260
#> 9 1.784669 2.514538 1.678592
#> 10 1.699254 2.310560 1.762970