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'. I the original object is of class 'mefa', it must have at least one attribute table, that is not NULL
(and not the same as stated by which
), because the stratified attribute table will be NULL
in the end. If both attribute tables are not NULL
, the result will be of 'mefa', if the other attribute table is NULL
, the result will be of 'xcount'. Sttatifying 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' of 'mefa'.
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)