fundiversity
provides a lightweight package to compute
common functional diversity indices. To a get a glimpse of what
fundiversity
can do refer to the introductory
vignette. The package is built using clear, public design
principles inspired from our own experience and user feedback.
You can install the stable version from CRAN with:
install.packages("fundiversity")
Alternatively, you can install the development version with:
install.packages("fundiversity", repos = "https://bisaloo.r-universe.dev")
fundiversity
lets you compute six functional diversity
indices: Functional Richness with fd_fric()
, intersection
with between convex hulls with fd_fric_intersect()
,
Functional Divergence with fd_fdiv()
, Rao’s Quadratic
Entropy with fd_raoq()
, Functional Dispersion with
fd_fdis()
and Functional Evenness with
fd_feve()
. You can have a brief overview of the indices in
the introductory
vignette.
All indices can be computed either using global trait data or at the site-level:
library(fundiversity)
# Get trait data included in the package
data("traits_birds")
# Compute Functional Richness of all birds included
fd_fric(traits_birds)
#> site FRic
#> 1 s1 230967.7
# Compute Functional Divergence
fd_fdiv(traits_birds)
#> site FDiv
#> 1 s1 0.7282172
# Compute Rao's Quadratic Entropy
fd_raoq(traits_birds)
#> site Q
#> 1 s1 170.0519
# Compute Functional Dispersion
fd_fdis(traits_birds)
#> site FDis
#> 1 s1 146.2072
# Compute Functional Evenness
fd_feve(traits_birds)
#> site FEve
#> 1 s1 0.3743341
To compute Rao’s Quadratic Entropy, the user can also provide a distance matrix between species directly:
= as.matrix(dist(traits_birds))
dist_traits_birds
fd_raoq(traits = NULL, dist_matrix = dist_traits_birds)
#> site Q
#> 1 s1 170.0519
Function Name | Index Name | Parallelizable[1] | Memoizable[2] |
---|---|---|---|
fd_fric() |
FRic | ✅ | ✅ |
fd_fric_intersect() |
FRic_intersect | ✅ | ✅ |
fd_fdiv() |
FDiv | ✅ | ✅ |
fd_feve() |
FEve | ✅ | ❌ |
fd_fdis() |
FDis | ✅ | ❌ |
fd_raoq() |
Rao’s Q | ❌ | ❌ |
Thanks to the future.apply
package, all functions
(except fd_raoq()
) within fundiversity
support
parallelization through the future
backend. To toggle
parallelization follow the future
syntax:
::plan(future::multisession)
futurefd_fdiv(traits_birds)
#> site FDiv
#> 1 s1 0.7282172
For more details please refer to the parallelization
vignette or use
vignette("parallel", package = "fundiversity")
within
R.
According to Pavoine & Bonsall (2011) classification, functional
diversity indices can be classified in three “domains” that assess
different properties of the functional space: richness, divergence, and
regularity. We made sure that the computations in the package are
correct in our correctness
vignette. fundiversity
provides function to compute
indices that assess this three facets at the site scale:
Scale | Richness | Divergence | Evenness |
---|---|---|---|
α-diversity (= among sites) |
FRic with fd_fric() |
FDiv with fd_fdiv() Rao’s QE with fd_raoq() FDis with fd_fdis() |
FEve with fd_feve() |
β-diversity (= between sites) |
FRic pairwise intersection with fd_fric_intersect() alternatives available in betapart |
available in entropart , betapart or
hillR |
available in BAT |
Several other packages exist that compute functional diversity indices. We did a performance comparison between related packages. We here mention some of them (but do not mention the numerous wrappers around these packages):
Package Name | Indices included | Has vignettes | Has tests | On GitHub | On CRAN (last updated) |
---|---|---|---|---|---|
adiv |
Functional Entropy, Functional Redundancy | ✅ | ❌ | ❌ | |
BAT |
β-diversity indices, Richness, divergence, and evenness with hypervolumes | ❌ | ❌ | ✅ | |
betapart |
Functional β-diversity | ❌ | ❌ | ❌ | |
entropart |
Functional Entropy | ✅ | ✅ | ✅ | |
FD |
FRic, FDiv, FDis, FEve, Rao’s QE, Functional Group Richness | ❌ | ❌ | ❌ | |
hilldiv |
Dendrogram-based Hill numbers for functional diversity | ❌ | ❌ | ✅ | |
hillR |
Functional Diversity Hill Numbers | ❌ | ✅ | ✅ | |
hypervolume |
Hypervolume measure of functional diversity (~FRic) | ✅ | ❌ | ✅ | |
mFD |
Functional α- and β-diversity indices, including FRic, FDiv, FDis, FEve, FIde, FMPD, FNND, FOri, FSpe, Hill Numbers | ✅ | ❌ | ✅ | |
TPD |
FRic, FDiv, FEve but for probability distributions | ✅ | ❌ | ❌ | |
vegan |
Only dendrogram-based FD (treedive() ) |
✅ | ✅ | ✅ |
parallelization through the future
backend please
refer to the parallelization
vignette for details.
memoization means that the results of the functions calls are
cached and not recomputed when recalled, to toggle it off see the
fundiversity::fd_fric()
Details
section.