| cwm | R Documentation |
Average value of each of a series of traits in multiple communities.
cwm(comm, trait, abund = TRUE, geo = FALSE, na.rm = FALSE)
comm |
A sites x species matrix, with incidence or abundance data about the species in the community. |
trait |
A species x traits matrix, with trait values for each species in comm. |
abund |
A boolean (T/F) indicating whether abundance data should be used (TRUE) or converted to incidence (FALSE) before analysis. If not specified, default is TRUE. |
geo |
Calculate using geometric instead of arithmetic mean (Liu et al. 2026)? |
na.rm |
Remove NA values before calculating cwm. |
Community weighted mean is used to compare communities in terms of their "typical" trait values.
A sites x trait matrix with mean value per site and trait.
Liu, C., Yang, X. & He, N. (2026) Rethinking community-weighted means: why geometric averages matter. Oikos, in press.
comm <- matrix(c(2,5,0,0,0,1,1,0,0,0,0,1,2,0,0,0,0,0,10,1), nrow = 4, ncol = 5, byrow = TRUE)
rownames(comm) = c("Site1","Site2","Site3","Site4")
colnames(comm) = c("Sp1","Sp2","Sp3","Sp4","Sp5")
trait <- data.frame(Trait1 = c(1,0,0,2,0), Trait2 = c(rep("A",2), rep("B",3)))
rownames(trait) = colnames(comm)
cwm(comm, trait)
cwm(comm, trait, FALSE)
cwm(comm, trait, geo = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.