colSums: Row and Column Sums for Objects of Class VegsoupData*

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Form row and column sums or means for the the species matrix based on presence/absence and numeric matrices.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S4 method for signature 'Vegsoup'
colSums(x, na.rm = FALSE, dims = 1, typeof = "logical", ...)

## S4 method for signature 'Vegsoup'
rowSums(x, na.rm = FALSE, dims = 1, typeof = "logical", ...)

## S4 method for signature 'Vegsoup'
colMeans(x, na.rm = FALSE, dims = 1, typeof = "numeric", ...)

## S4 method for signature 'Vegsoup'
rowMeans(x, na.rm = FALSE, dims = 1, typeof  = "numeric", ...)

Arguments

x

An Vegsoup* object.

na.rm

logical. Should missing values (including NaN) be omitted from the calculations?

dims

Not used.

typeof

The mode of the species matrix to compute values from, defaults to "logical" for rowSums and colSums. See as.matrix for details about argument 'typeof'. The rowMeans and colMeans methods use typeof = "numeric" as the default and typeof = "character" is not supported by neither of the functions.

...

Arguments passed to rowSums, rowSums, colSums and colMeans, respectively.

Details

Note, the default behaviour (argument typeof is missing) operates on a presence/absence version of the species matrix as can be obtained by as.logical(x) or as.matrix(x, typeof = "logical"). On this basis colSums returns the number of occurences of a species in the data set. The rowSums method returns the number of species with duplicated occurences of species on different layers if there is more than one layer and at least a single species occuring in more than one layer! In this case correct species richness can be obtained with method richness(obj, "sample").

The colSums

Value

A numeric vector of suitable size with names taken from the object.

Author(s)

Roland Kaiser

See Also

colSums in package base, as.matrix in package vegsoup, richness, layers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require(vegsoup)

data(barmstein)
x <- barmstein

# number of species per plot including layer replication
# default method defines typeof = "logical"
rowSums(x)

#   true species richness
richness(x, "sample")

#   sums of abundances per plot according to coverscale(x)
rowSums(x, typeof = "numeric")

# number of occurences for each species (typeof = "logical")
colSums(x)

# sums of abundances for each species including layer replication
colSums(x, typeof = "numeric")

# mean abundances, also with layer replication!
m1 <- colMeans(x)

# combine all strata
x0 <- layers(x, collapse = "NA") # note, collapse = NA will not work!
m2 <- colMeans(x0, typeof = "numeric")

m1[ grep("amel.oval", names(m1)) ]
m2[ grep("amel.oval", names(m2)) ]

vegsoup documentation built on Feb. 24, 2021, 3 a.m.