Skip to contents

Calculates spatial beta diversity for taxonomic (TD), functional (FD), and phylogenetic (PD) dimensions. Adapted from beta.

Usage

spat.beta(
  x,
  tree,
  filename = "",
  global = FALSE,
  fm = NULL,
  d = mean(terra::res(terra::rast(x))) * 2,
  type = "circle",
  na.policy = "omit",
  ...
)

Arguments

x

A SpatRaster with presence-absence data (0 or 1) for a set of species.

tree

It can be a 'data.frame' with species traits or a 'phylo' with a rooted phylogenetic tree. Species names in 'tree' and 'x' must match!

filename

Character. Save results if a name is provided.

global

Logical. Mean of pairwise comparisons between focal cell and its neighbors (default) or mean of all pairwise comparisons.

fm

Numeric. Focal matrix ("moving window").

d

Window radius to compute beta diversity.

type

Character. Window format. Default = "circle".

na.policy

Character. Default = "omit". See ?terra::focal3D for details.

...

Additional arguments to be passed passed down from a calling function.

Value

A SpatRaster with beta results (total, replacement, richness difference, and ratio).

Details

The TD beta diversity partitioning framework we used was developed by Podani and Schmera (2011) and Carvalho et al. (2012) and expanded to PD and FD by Cardoso et al. (2014).

References

Cardoso, P. et al. 2014. Partitioning taxon, phylogenetic and functional beta diversity into replacement and richness difference components. - Journal of Biogeography 41: 749–761.

Carvalho, J. C. et al. 2012. Determining the relative roles of species replacement and species richness differences in generating beta-diversity patterns. - Global Ecology and Biogeography 21: 760–771.

Podani, J. and Schmera, D. 2011. A new conceptual and methodological framework for exploring and explaining pattern in presence - absence data. - Oikos 120: 1625–1638.

Hidasi-Neto, J. et al. 2019. Climate change will drive mammal species loss and biotic homogenization in the Cerrado Biodiversity Hotspot. - Perspectives in Ecology and Conservation 17: 57–63.

Examples

# \donttest{
library(terra)
bin1 <- terra::rast(system.file("extdata", "ref.tif",
package = "divraster"))
traits <- read.csv(system.file("extdata", "traits.csv",
package = "divraster"), row.names = 1)
rownames(traits) <- names(bin1)
tree <- ape::read.tree(system.file("extdata", "tree.tre",
package = "divraster"))
spat.beta(bin1)
#> class       : SpatRaster 
#> dimensions  : 8, 8, 4  (nrow, ncol, nlyr)
#> resolution  : 0.125, 0.125  (x, y)
#> extent      : 0, 1, 0, 1  (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326) 
#> source(s)   : memory
#> names       : Btotal_TD,  Brepl_TD,  Brich_TD, Bratio_TD 
#> min values  : 0.5515512, 0.1898990, 0.0952381, 0.3174335 
#> max values  : 0.8694805, 0.7207341, 0.5067460, 0.8529412 
spat.beta(bin1, traits)
#> class       : SpatRaster 
#> dimensions  : 8, 8, 4  (nrow, ncol, nlyr)
#> resolution  : 0.125, 0.125  (x, y)
#> extent      : 0, 1, 0, 1  (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326) 
#> source(s)   : memory
#> names       : Btotal_FD,   Brepl_FD,  Brich_FD, Bratio_FD 
#> min values  : 0.3310466, 0.06122664, 0.1271726, 0.1285775 
#> max values  : 0.6641360, 0.41959062, 0.5680299, 0.7351086 
spat.beta(bin1, tree)
#> class       : SpatRaster 
#> dimensions  : 8, 8, 4  (nrow, ncol, nlyr)
#> resolution  : 0.125, 0.125  (x, y)
#> extent      : 0, 1, 0, 1  (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326) 
#> source(s)   : memory
#> names       : Btotal_PD,   Brepl_PD,   Brich_PD, Bratio_PD 
#> min values  : 0.3250871, 0.04931651, 0.06867094, 0.1265763 
#> max values  : 0.7072649, 0.52737261, 0.46375695, 0.8271077 
# }