Learn R Programming

mefa (version 2.0-1)

mefaCrosstab: Cross Tabulate an Object of Class 'stcs'

Description

The function makes cross tabulation of an object of class 'stcs'. Similar to the table function but handles specialties of the 'stcs' object class (i.e. removes 'pseudo species' created to indicate empty samples). This is used internally by the function mefa to make 3 dimensional representation of the data.

Usage

mefaCrosstab(x, segment = FALSE, nested = FALSE, drop.zero = FALSE)

Arguments

x
an object of class 'stcs'.
segment
logical, if TRUE, the crosstabulation is made in 2 dimensions by the samp (sample) and taxa columns of the x. Otherwise, crosstabulation is made in 3 dimensions by the samp, taxa
nested
logical, if FALSE count values of each segments are independent, if TRUE crosstabulated matrices are summed up in a nested fashion from segment level 1 to the number of segments (it is indicated in the segment levels as well).
drop.zero
argument passed to the function stcs, indicating whether empty samples (with zero sum) should be removed prior to cross tabulation (TRUE), or not (FALSE).

Value

  • It returs a matrix if segment = FALSE or a list with matrices for the segments if segment = TRUE.

encoding

UTF-8

Details

The cross tabulation of an object of class 'stcs' is made after the inflation of the data table by the expand = TRUE argument of the function stcs. The inflation is made by the function inflate.

References

Sólymos{Solymos} P. 2008. mefa: an R package for handling and reporting count data. Community Ecology 9, 125--127.

http://mefa.r-forge.r-project.org/

See Also

stcs, mefa, inflate

Examples

Run this code
x <- data.frame(sample = LETTERS[c(1,1,2,2,3,4)],
    species = c(letters[c(5,5,5,6,7)], "zero.pseudo"),
    count = c(1,2,10,3,4,0), segment = letters[c(8,9,8,9,8,8)])
y <- stcs(x)
mefaCrosstab(y)
mefaCrosstab(y, segment = TRUE)
mefaCrosstab(y, segment = TRUE, nested = TRUE)

Run the code above in your browser using DataLab