cwm: Community weighted mean of species attributes

Description Usage Arguments Details Value Author(s) Examples

Description

Function cwm calculates weighted mean of species attributes, using matrix of species composition and one or several species attributes.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
cwm(com, traits, wstand = FALSE)

is.cwm(object)

## S3 method for class 'cwm'
object[i, j, drop = FALSE]

## S3 method for class 'cwm'
summary(object, long = FALSE, ...)

## S3 method for class 'cwm'
print(x, ...)

extract(x, ...)

## S3 method for class 'cwm'
extract(x, what = "traits", ...)

range_cwm(object, max = 9, recalculate = TRUE)

Arguments

com

Matrix or data frame with species composition data (samples x species).

traits

Vector, matrix or data frame with species attributes (species x attributes). This can be numeric or factor.

wstand

Logical. Should be the values in traits weighted-standardized prior to calculation of CWM? Weights are column sums in community data matrix com.

object, x

Object of the class cwm

i, j

Subscripts of the matrix of the class "cwm" (rows and columns).

drop

Argument in the subsetting function, but currently not implemented ([.cwm always return data frame with at least one variable).

long

should summary return long output? (TRUE vs FALSE)

...

Other arguments passed into as.matrix, summary or print function. Currently not supported.

what

Attributes extracted from the object of class cwm; either traits for the matrix of species attributes (species x traits), or com for matrix of species composition (samples x species).

max

upper bound of the rescaled values

recalculate

should the mean values in object be recalculated?

Details

Function [.cwm] is for extracting specified rows and columns from matrix of class cwm. As a side effect, resulting object will have concatenated the com and traits attributes to match the dimension of the resulting matrix. This function is only for extracting the parts of cwm object, not for replacing - the attempt to replace will work, but will break the inner structure of the object.

Generic function extract with argument what applied on object of class "cwm" extracts the original species composition matrix or species attribute matrix, respectively, which were used to calculate weighted means.

Function range_cwm changes the range of species attributes and recalculates the CWM values.

Value

Object of class "cwm", which has print, summary, as.matrix and '[.' methods. Object of "cwm" class contains the matrix of calculated weighted means of species attributes for each sample (sample x weighted mean) and three attributes: com, species x sample matrix from which the weighted mean was calculated, traits, species x attributes matrix with species attributes, and wstand, logical value specifying whether traits were weighted-standardized prior to calculation of CWM (weights are column sums of com). All weighted means of species attributes must be based on the same species x sample matrix with the same number of samples.

Author(s)

David Zeleny (zeleny.david@gmail.com)

Examples

1
2
3
4
5
6
7
8
9
# Calculation of weighted mean of species Ellenberg indicator values using dataset Vltava
data (vltava)
mean.eiv <- cwm (com = vltava$spe, traits = vltava$eiv)

summary (mean.eiv)

# Extracting values from the object of cwm class
mean.eiv[,1]
mean.eiv[1:10, 2:3]

zdealveindy/weimea documentation built on Sept. 21, 2021, 2:15 p.m.