functcomp | R Documentation |
functcomp
returns the functional composition of a set of communities, as measured by the community-level weighted means of trait values (CWM; e.g. Lavorel et al. 2008).
functcomp(x, a, CWM.type = c("dom", "all"), bin.num = NULL)
x |
matrix or data frame containing the functional traits. Traits can be |
a |
matrix containing the abundances of the species in |
CWM.type |
character string indicating how nominal, binary and ordinal traits should be handled. See ‘details’. |
bin.num |
vector indicating binary traits to be treated as continuous. |
functcomp
computes the community-level weighted means of trait values for a set of communities (i.e. sites). For a continuous trait, CWM is the mean trait value of all species present in the community (after excluding species with NAs
), weighted by their relative abundances.
For ordinal, nominal and binary traits, either the dominant class is returned (when CWM.type
is "dom"
), or the abundance of each individual class is returned (when CWM.type
is "all"
).
The default behaviour of binary traits being treated as nominal traits can be over-ridden by specifying bin.num
, in which case they are treated as numeric traits.
When CWM.type = "dom"
, if the maximum abundance value is shared between two or more classes, then one of these classes is randomly selected for CWM. Because species with NAs
for a given trait are excluded for that trait, it is possible that when CWM.type
is set to "all"
, the sum of the abundances of all classes for a given ordinal/nominal/binary trait does not equal the sum of the species abundances. Thus, it is definitely not recommended to have NAs
for very abundant species, as this will lead to biased estimates of functional composition.
a data frame containing the CWM values of each trait for each community.
functcomp
is implemented in dbFD
and will be returned if calc.CWM
is TRUE
.
Etienne Laliberté etiennelaliberte@gmail.com https://www.elaliberte.info/
Lavorel, S., K. Grigulis, S. McIntyre, N. S. G. Williams, D. Garden, J. Dorrough, S. Berman, F. Quétier, A. Thébault and A. Bonis (2008) Assessing functional diversity in the field - methodology matters! Functional Ecology 22:134-147.
dbFD
for measuring distance-based multidimensional functional diversity indices, including CWM.
# for ordinal, nominal and binary variables
# returns only the most frequent class
ex1 <- functcomp(dummy$trait, dummy$abun)
ex1
# returns the frequencies of each class
ex2 <- functcomp(dummy$trait, dummy$abun, CWM.type = "all")
ex2
# example with real data from New Zealand short-tussock grasslands
ex3 <- functcomp(tussock$trait, tussock$abun)
ex3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.