wm: Weighted mean of species attributes

Description Usage Arguments Details Value Author(s) Examples

View source: R/wm.r

Description

Function wm calculates weighted mean of species attributes, using matrices of species composition and species attributes. Other functions are for handling the objects of class wm.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
wm(sitspe, speatt)

wmR(sitspe, speatt)

is.wm(object)

## S3 method for class 'wm'
object[i, j, drop = F]

## S3 method for class 'wm'
as.matrix(x, ...)

## S3 method for class 'wm'
summary(object, long = F, ...)

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

Arguments

sitspe

Matrix or data.frame with community data matrix (sites x species)

speatt

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

object, x

Object of the class wm

i, j

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

drop

In function [.wm] if TRUE coerces the result to the lowest possible dimension (i.e. vector if matrix has only one column). Currently not implemented, change into TRUE will have no effect.

...

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

long

should summary return long output? (TRUE vs FALSE)

Details

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

Generic functions sitspe and speatt applied on object of class "wm" extracts the original species composition matrix and species attribute matrix, respectively, which were used to calculate weighted means.

Value

Object of class "wm", which has print, summary, as.matrix and '[.' methods. Object of "wm" class contains the matrix of calculated weighted means of species attributes for each sample (sample x weighted mean) and two attributes: sitspe species x sample matrix from which the weighted mean was calculated, and speatt species x attributes matrix with species attributes. 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 ([email protected])

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 <- wm (sitspe = vltava$spe, speatt = vltava$ell)

summary (mean.eiv)

# Extracting values from the object of \code{wm} class
mean.eiv[,1]
mean.eiv[1:10, 2:3]

zdealveindy/weimea documentation built on Dec. 5, 2017, 11:25 p.m.