summarizeEpmGridList {epm} | R Documentation |
Summarize lists of epmGrid objects
Description
If a diversity metric was calculated for an epmGrid object
that contained a phylogenetic distribution, then a list of resulting
epmGrid objects was returned. This function will take that list, and
apply a summary statistic, returning a single epmGrid object.
If the input list is from betadiv_phylogenetic
, then that
list of sf or SpatRaster objects can also be summarized with this function.
Usage
summarizeEpmGridList(x, fun = mean)
Arguments
x |
a list of objects of class |
fun |
a function to apply to grid cells across the list x. |
Details
It is assumed that across the objects in list x, the only difference is the values for the grid cells.
Value
a single object of class epmGrid
or sf
or SpatRaster
.
Author(s)
Pascal Title
Examples
tamiasEPM <- addPhylo(tamiasEPM, tamiasTreeSet)
tamiasEPM <- addTraits(tamiasEPM, tamiasTraits)
x <- gridMetrics(tamiasEPM, metric='meanPatristicNN')
z <- summarizeEpmGridList(x, fun = var)
# using a custom function
f <- function(y) sum(y) / length(y)
z <- summarizeEpmGridList(x, fun = f)
# works with square grid epmGrids too
tamiasEPM2 <- createEPMgrid(tamiasPolyList, resolution = 50000,
cellType = 'square', method = 'centroid')
tamiasEPM2 <- addPhylo(tamiasEPM2, tamiasTreeSet)
tamiasEPM2 <- addTraits(tamiasEPM2, tamiasTraits)
x <- gridMetrics(tamiasEPM2, metric='meanPatristicNN')
z <- summarizeEpmGridList(x, fun = median)
# With phylogenetic distribution
tamiasEPM <- addPhylo(tamiasEPM, tamiasTreeSet, replace = TRUE)
beta_phylo_turnover <- betadiv_phylogenetic(tamiasEPM, radius = 70000,
component = 'turnover')
z <- summarizeEpmGridList(beta_phylo_turnover)
tamiasEPM2 <- createEPMgrid(tamiasPolyList, resolution = 50000,
cellType = 'square', method = 'centroid')
tamiasEPM2 <- addPhylo(tamiasEPM2, tamiasTreeSet)
beta_phylo_turnover <- betadiv_phylogenetic(tamiasEPM2, radius = 70000,
component = 'turnover')
z <- summarizeEpmGridList(beta_phylo_turnover, fun = median)
[Package epm version 1.1.2 Index]