Skip to contents

Compute Functional Divergence (FDiv)

Usage

fd_fdiv(traits, sp_com)

Arguments

traits

The matrix dataset for which you want to compute the index

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.

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.

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.

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("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)
#>   site      FDiv
#> 1   s1 0.7282172