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)
- matrix or data frame containing the functional traits. Traits can be
factor. Binary traits should be
numericand only contain 0 and 1.
charactertraits will be converted to
factor. For a given trait, species with
- matrix containing the abundances of the species in
x(or presence-absence, i.e. 0 or 1). Rows are sites and species are columns. The number of species (columns) in
amust match the number of species (rows) in
x. In addition, the species labels in
xmust be identical and in the same order.
NAswill be replaced by 0.
- character string indicating how nominal, binary and ordinal traits should be handled. See details.
- 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
"dom"), or the abundance of each individual class is returned (when
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.
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
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