Learn R Programming

BAT (version 2.9.6)

cwd: Community Weighted Dispersion.

Description

Standard deviation value of each of a series of traits in multiple communities.

Usage

cwd(comm, trait, abund = TRUE, na.rm = FALSE)

Value

A sites x trait matrix with sd value per site and trait.

Arguments

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.

na.rm

Remove NA values before calculating cwd.

Details

Community weighted dispersion is used to compare communities in terms of their dispersion of trait values around a mean, reflecting individual trait variability or diversity.

Examples

Run this code
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 <- matrix(c(1,1,0,0,0,0,2,1,0,0,0,0,2,1,0,0,0,0,2,1), nrow = 5, ncol = 4, byrow = TRUE)
rownames(trait) = colnames(comm)
colnames(trait) = c("Trait1","Trait2","Trait3","Trait4")
cwd(comm, trait)
cwd(comm, trait, FALSE)

Run the code above in your browser using DataLab