| spaccPhylo | R Documentation |
Compute spatial accumulation of phylogenetic diversity metrics (MPD, MNTD, PD).
spaccPhylo(
x,
coords,
tree,
metric = c("mpd", "mntd"),
n_seeds = 50L,
method = "knn",
distance = c("euclidean", "haversine"),
parallel = TRUE,
n_cores = NULL,
progress = TRUE,
seed = NULL,
map = FALSE
)
x |
A site-by-species matrix. |
coords |
A data.frame with columns |
tree |
A phylogenetic tree of class |
metric |
Character vector. Metrics to compute:
|
n_seeds |
Integer. Number of random starting points. Default 50. |
method |
Character. Accumulation method. Default |
distance |
Character. Site distance method: |
parallel |
Logical. Use parallel processing? Default |
n_cores |
Integer. Number of cores. |
progress |
Logical. Show progress? Default |
seed |
Integer. Random seed. |
map |
Logical. If |
Phylogenetic diversity metrics incorporate evolutionary relationships:
MPD (Mean Pairwise Distance): Average phylogenetic distance between all pairs of species. Sensitive to tree-wide patterns.
MNTD (Mean Nearest Taxon Distance): Average distance to closest relative. Sensitive to terminal clustering.
PD (Faith's Phylogenetic Diversity): Total branch length connecting species. Requires full tree object.
An object of class spacc_phylo containing:
curves |
Named list of matrices, one per metric (n_seeds x n_sites) |
metric |
Metrics computed |
coords, n_seeds, n_sites, method |
Parameters used |
Faith, D.P. (1992). Conservation evaluation and phylogenetic diversity. Biological Conservation, 61, 1-10.
Webb, C.O. (2000). Exploring the phylogenetic structure of ecological communities: an example for rain forest trees. American Naturalist, 156, 145-155.
picante::mpd(), picante::mntd(), picante::pd()
if (requireNamespace("ape", quietly = TRUE)) {
# Create random tree
tree <- ape::rtree(30)
coords <- data.frame(x = runif(50), y = runif(50))
species <- matrix(rbinom(50 * 30, 1, 0.3), nrow = 50)
colnames(species) <- tree$tip.label
phylo <- spaccPhylo(species, coords, tree, metric = c("mpd", "mntd"))
plot(phylo)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.