This function calculates the phylogenetic diversity (PD) for a given dataset and phylogenetic tree.
Arguments
- Fin
A data frame or data table containing species presence data. The data should include columns for
species,cell, andLanduse.- Tree
A phylogenetic tree object, typically generated by the
V.PhyloMaker::phylo.makerfunction. The tree must contain a component namedscenario.3with the tip labels.
Value
A data table containing the calculated phylogenetic diversity (PD) for each cell, along with the associated cell and Landuse.
Examples
if (FALSE) { # \dontrun{
# Example usage:
Fin <- data.table(
cell = c(1, 1, 2, 2),
species = c("species_a", "species_b", "species_a", "species_c"),
Landuse = c("forest", "forest", "grassland", "grassland")
)
# Assume this generates a valid tree object
Tree <- V.PhyloMaker::phylo.maker(...)
# Calculate phylogenetic diversity
pd_results <- calc_pd(Fin, Tree)
print(pd_results)
} # }
