rast.pd: Calculate phylogenetic diversity for raster data

View source: R/rast.pd.ses.R

rast.pdR Documentation

Calculate phylogenetic diversity for raster data

Description

Calculate the sum of the branch length for species present in each cell of the raster.

Usage

rast.pd(
  x,
  tree,
  edge.path,
  branch.length,
  full_tree_metr = TRUE,
  filename = "",
  ...
)

Arguments

x

SpatRaster. A SpatRaster containing presence-absence data (0 or 1) for a set of species. The layers (species) will be sorted according to the tree order. See the phylo.pres function.

tree

phylo. A dated tree.

edge.path

matrix. Matrix representing the paths through the tree from root to each tip. See phylo.pres

branch.length

numeric. A Named numeric vector of branch length for each species. See phylo.pres

full_tree_metr

logical. Whether edge.path, branch length and number of descendants should be calculated with the full (TRUE) or the prunned tree (FALSE). The default is TRUE.

filename

character. Output filename

...

additional arguments passed for terra::app

Value

SpatRaster

Author(s)

Neander Marcel Heming and Gabriela Alves-Ferreira

References

Faith, D. P. (1992). Conservation evaluation and phylogenetic diversity. Biological conservation, 61(1), 1-10.

Examples


library(terra)
library(phyloraster)
x <- rast(system.file("extdata", "rast.presab.tif",
package="phyloraster"))
tree <- ape::read.tree(system.file("extdata", "tree.nex",
package="phyloraster"))
data <- phylo.pres(x[[1:3]], tree)
pd <- rast.pd(data$x, data$tree)
plot(pd)


phyloraster documentation built on April 3, 2025, 8:45 p.m.