mefa(xtab, samp = NULL, taxa = NULL, id.samp = NULL, id.taxa = NULL,
segment = TRUE, nested = FALSE, drop.zero = FALSE, drop.index = FALSE,
xtab.fixed = TRUE)
## S3 method for class 'mefa':
as(x, \ldots)
## S3 method for class 'mefa':
is(x)
## S3 method for class 'mefa':
print(x, \ldots)
## S3 method for class 'mefa':
summary(object, \ldots)
## S3 method for class 'summary.mefa':
print(x, nlist = 10, \ldots)
## S3 method for class 'mefa':
dim(x)
## S3 method for class 'mefa':
dimnames(x)NULL. See argument xtab.fixed and details for sample matching options.NULL. See argument xtab.fixed and details for taxa matching options.NULL if sample names for matching are the rownames of samp, otherwise, the index refers to the column of samp where the names are located.NULL if taxa names for matching are the rownames of taxa, otherwise, the index refers to the column of taxa where the names are located.TRUE, default). It has no effect when xtab is matrix or data frame.TRUE) or not (FALSE, default).TRUE empty samples are removed from the result (can be useful before multivariate analyses). Otherwise, empty rows are left intact (FALSE, default).TRUE) to reduce redundancy or not (FALSE, default). This argument has effect only if id.samp and TRUE (default) the samp and taxa tables are subsetted and ordered according to the names of xtab. If FALSE, xtab is also subsetted according to the intersect of the mefa function returns an object of class 'mefa'. It is a list with 5 elements:NULL.NULL.NULL.summary.mefa function returns a list invisibly, with elements:dim returns a vector of length 3 with values for number of samples, number of taxa and number of segments in the 'mefa' object. The third value is 1 in cases, when s$segm is NULL (because it is 1 undefined segment essentially identical.to the matrix x$xtab, thus no need for a replicate).The dimnames method returns a list of three character vectors for names of samples, taxa and segments. These can be NULL as well.
mefa function are to (1) convert a long formatted object of 'stcs' into a crosstabulated and optionally segmented 'mefa' object and (2) link this crosstabulation with tables of samples and taxa. The segments can be nested within each other. This feature can be useful, if segments represent e.g. subsequent sampling periods (years) and the the aim is to detect effects of data accumulation over time.A mefa object can be viewed as a project oriented compendium of the data. It contains 3 dimensional (samples, taxa, segments) representation of the count data and data tables for samples and taxa. Segments contain information on some particular internal division of the data (sub populations, method specific partitions, repeated measures), but it has technical significance. Thus data tables for segments are not supported.
If the input xtab is a matrix, dimnames are necessary if either samp or taxa tables are provided. In other cases, dimnames are not necessary. In this way, simple statistics can be returned for the matrix.
The print method returns basic information, instead of a long structural representation.
The summary contains statistics calculated from the 'mefa' object (species richness, number of individuals, occupancy, abundance, total sum, matrix fill, etc., see 'Value' section). The list can be recalled by e.g. unclass(summary(x)), elements of the list e.g. summary(x)$srich.
Methods for extracting, subsetting, plotting and reporting 'mefa' objects are discussed elsewhere (see links in 'See also' section). On how the 'mefa' objects can be used in further analyses, see 'Examples'.
[.mefa and aggregate.mefa for extracting and aggregating the data, melt.mefa for redefining segments or melting data into long format, report.mefa for generating report into file, and plot.mefa boxplot.mefa and image.mefa for graphical display.The simple 2 dimensional wide arrangement of long formatted data can be done by the function reshape in the reshape package of Hadley Wickham, and by the mama function in the simba package by Gerald Jurasinski. These are, however, not useful either for 3 dimensional (segmented) crosstabulation (see table function), or linking data tables for sample and taxa with the count data.
data(DOLINAcounts, DOLINAsamples, DOLINAtaxa)
## Input is stcs
x1 <- mefa(stcs(DOLINAcounts))
x1
## Input is matrix
x2 <- mefa(x1$xtab)
x2
## Attach data frame for samples
x3 <- mefa(stcs(DOLINAcounts), DOLINAsamples)
x3
## Attach data frame for samples and taxa
x4 <- mefa(stcs(DOLINAcounts), DOLINAsamples, DOLINAtaxa)
x4
## Methods
## (chapter 'See also' provides
## links for further methods)
summary(x4)
## Descriptives inside the summary
unclass(summary(x4))
## Testing mefa objects
is(x4, "mefa")
## Dimensions
dim(x4)
## Dimnames
dimnames(x4)
## Simple examples how to use mefa objects in analyis
## GLM on sample abundances
mod <- glm(summary(x4)$nind ~ .^2,
data = x4$samp[, c(4, 6)], family = quasipoisson)
summary(mod)
## Cluster analysis of community matrix
x5 <- aggregate(x4, c("method", "microhab"))
h <- hclust(dist(x5$xtab))
plot(h)Run the code above in your browser using DataLab