strify {mefa} | R Documentation |
Stratifies an object of class 'xcount' or 'mefa' according to levels of a factor, or sample/species attribute, respectively.
strify(xc, strata, which = c("samples", "species"))
xc |
an object of class 'xcount' or 'mefa' to be stratified. |
strata |
a vector with length equal to the number of samples/species (according to which argument).
For a 'mefa' object strata is a column within the samples/species attribute table (according to
which argument). |
which |
switches between rows ("samples" ) and columns ("species" ) to be stratified. |
If the original object is of class 'xcount', the result will be also of 'xcount'. If the original object is of class 'mefa', it must have at least one attribute table, that is not NULL
. The stratified attribute table will be NULL
in the resulting object. If neither attribute tables are NULL
, the result will a 'mefa', if both attribute tables are NULL
, the result will an 'xcount' object. Stratifying according to a NULL
attribute table has no sense, and an error message is given. In this case use function as.xcount
.
A result is an object of class 'xcount' or 'mefa'.
This function will be entirely rewritten soon.
Peter Solymos, Solymos.Peter@aotk.szie.hu, http://www.univet.hu/users/psolymos/personal/
as.xcount
, check.attrib
, mefa
, sscount
,
xcount
, xorder
## Not run: data(landsnail, vhabitat, vsample, vtable) v1 <- as.xcount(vtable, FALSE, segment="mixed") spec <- xorder(v1, which="species", landsnail, 2) sampl <- xorder(v1, which="samples", vsample, 1) vmf <- mefa(v1, sampl, spec) v2 <- strify(vmf, strata = "site.descr", which = "samples") v2 ## output is 'mefa' v3 <- strify(v2, strata = "familia", which = "species") v3 ## output is 'xcount' check.attrib(as.xcount(v2), which="samples", vhabitat, 2) habi <- xorder(as.xcount(v2), which="samples", vhabitat, 2) vmf2 <- mefa(as.xcount(v2), habi, spec) vmf2 ## 'mefa' again with attributes ## End(Not run)