Learn R Programming

phyloregion (version 2.1.0)

tpd_groups: Global trait spectra of groups of species

Description

tpd_groups turns a grouping of species (for example threatened and non-threatened species, or plants of different habits) into a groups x species matrix. Use it in place of a community matrix in tpd_alpha and tpd_beta to describe the trait spectrum of each group and how much the spectra overlap, as in Carmona et al. (2021).

Usage

tpd_groups(group, all = TRUE)

Value

A sparse matrix with groups in rows and species in columns.

Arguments

group

A vector of group labels, one per species, named by species.

all

Logical, whether to add a row with all species together.

References

Carmona, C.P., Tamme, R., Partel, M. et al. (2021) Erosion of global functional diversity across the tree of life. Science Advances 7: eabf2675.

See Also

tpd_alpha, tpd_beta, tpd_extinction

Examples

Run this code
data(africa)
tr <- data.frame(species = africa$trait$species,
                 height = log10(africa$trait$h_max),
                 habit = africa$trait$habit)
status <- ifelse(africa$IUCN$IUCN %in% c("CR", "EN", "VU"),
                 "threatened", "not_threatened")
names(status) <- africa$IUCN$Species
g <- tpd_groups(status)
tpd_alpha(g, tr)          # trait spectrum of each group
tpd_beta(g, tr)           # how different the spectra are

Run the code above in your browser using DataLab