fd_fdiv: Compute Functional Divergence (FDiv)

View source: R/fd_fdiv.R

fd_fdivR Documentation

Compute Functional Divergence (FDiv)

Description

This function computes Functional Divergence (FDiv) following Villéger et al. (2008). NB: when a site contains no species FDiv is equal to 0. If for a site there are less traits than species, then FDiv is equal to NaN.

Usage

fd_fdiv(traits, sp_com)

Arguments

traits

Trait matrix with species as rows and traits as columns. It has to contain exclusively numerical values. This can be either a matrix, a data.frame, or a Matrix::Matrix() object.

sp_com

Site-species matrix with sites as rows and species as columns if not provided, the function considers all species with equal abundance in a single site. This can be either a matrix, a data.frame, or a Matrix::Matrix() object.

Details

By default, when loading fundiversity, the functions to compute convex hulls are memoised through the memoise package if it is installed. To deactivate this behavior you can set the option fundiversity.memoise to FALSE by running the following line: options(fundiversity.memoise = FALSE). If you use it interactively it will only affect your current session. Add it to your script(s) or .Rprofile file to avoid toggling it each time.

Value

a data.frame with two columns:

  • site the names of the sites as the row names of the input sp_com,

  • FDiv the values of functional divergence at each site.

NB: when a site contains no species FDiv is equal to 0. If for a site there are less traits than species, then FDiv is equal to NaN.

Parallelization

The computation of this function can be parallelized thanks to future::plan(). To get more information on how to parallelize your computation please refer to the parallelization vignette with: vignette("fundiversity_1-parallel", package = "fundiversity")

References

Villéger S., Mason N. W. H., Mouillot D. (2008), New multidimensional functional diversity indices for a multifaceted framework in functional ecology, Ecology 89(8), doi: 10.1890/07-1206.1

Examples

data(traits_birds)
fd_fdiv(traits_birds)


fundiversity documentation built on Nov. 21, 2022, 5:07 p.m.