Learn R Programming

mefa (version 1.0-4)

mefa: Makes Object of Class 'mefa'

Description

Makes and object of class 'mefa' from az 'xcont' and sample and species attribute 'xorder' objects. Incomplete 'mea' object can becreated, when one out of samples or species attributes is missing.

Usage

mefa(xc, xorder.samples, xorder.species)

## S3 method for class 'mefa':
print(x, \dots)

## S3 method for class 'mefa':
plot(x, sample.var = NULL, species.var = NULL, \dots)

Arguments

xc
object of class 'xcount'.
xorder.samples
object of class 'xorder' for sample attributes, or NULL.
xorder.species
object of class 'xorder' for species attributes, or NULL.
x
an object of class 'mefa'.
sample.var
column index (numeric or character) of the sample attribute table to plot as independent variable.
species.var
column index (numeric or character) of the species attribute table to plot as independent variable.
...
other arguments.

Value

  • A result is an object of class 'mefa'.
  • datacount data from the 'xcount' object.
  • sample.attrdata frame containing data of 'xorder' object containing sample attributes.
  • species.attrdata frame containing data of 'xorder' object containing species attributes.
  • callreturns the call.
  • segmentsegment of the 'xcount' object.
  • digitsdigits of the 'xcount' object.
  • nsamplesnumber of rows (samples) in data.
  • nspeciesnumber of columns (species) in data.
  • totalcountsum of count or measurement in data.
  • presencessum of presences in data.
  • nindsa vector, containing number of individuals (or sum of measurement values) within samples.
  • srichna vector, containing number of species (based on occurences) within samples.
  • specabunda vector, containing number of individuals (or sum of measurement values) within species.
  • specoccura vector, containing number of occurences within species.
  • attributescharacter, indicating the presence of "both" or only one ("samples.only" or "species.only") attribute tables.
  • attrib.matrixa matrix with 2 rows and 3 columns. Columns contain check.setrel, number of variables and na from 'xcount' objects for samples (first row) and species (second row). If one 'xorder' object is missing, respective row contains NAs.

Details

The plot method works as for 'xcount' objects if only a 'mefa' object is specified. If sample and species attributes (one or both) are also specified, scatterplots or box-and-whiskers diagrams are drawn, based on the type of the independent variable. Species richness, number of individuals, abundance and number of species occurrences are plotted as response variable. If the crosstable is binary, only richness and occurences are used.

See Also

check.attrib, marmat, sscount, xcount, xorder

Examples

Run this code
### Example 1: simple atrificial data

ss <- data.frame(
cbind(
c("sample1","sample1","sample2","sample2","sample3","sample4"),
c("species1","species1","species1","species2","species3","zero.count"),
c("male","female","male","female","male","male")
),
c(1, 2, 10, 3, 4, 1)
)
colnames(ss) <- c("sample.id", "species.id", "gender", "catch")

spectab <- as.data.frame(rbind(
	c("species3", "family1", "1"),
	c("species2", "family2", "5"),
	c("species1", "family1", "2"),
	c("species5", "family2", "1"),
	c("species4", "family1", "10")
))
colnames(spectab) <- c("species", "taxonomy", "size")

sampletab <- as.data.frame(rbind(
	c("sample3", "bad"),
	c("sample1", "good"),
	c("sample2", "good"),
	c("sample4", "bad")))
colnames(sampletab) <- c("sample", "quality")

xct <- xcount(sscount(ss, zc="zero.count"))
xo1 <- xorder(xct, "samples", sampletab, 1)
xo2 <- xorder(xct, "species", spectab, 1)

mf1 <- mefa (xct, xo1, xo2)
mf1

mf2 <- mefa(xcount(sscount(ss, zc="zero.count"), 2), xo1, xo2)
mf2

### Example 2: field data of Villany Hills

data(landsnail, vsample, vtable)

vt <- as.xcount(vtable, FALSE)
spec <- xorder(vt, which="species", landsnail, 2)
sampl <- xorder(vt, which="samples", vsample, 1)

vmf <- mefa(vt, sampl, spec)
vmf

plot(vmf)
plot(vmf,type="rank")
plot(vmf, 3)
plot(vmf, NULL, 5)
plot(vmf, "site.descr", "shell.dimension")

### Example 3: field data of the dolina

data(dol.count, dol.sample, landsnail)

dmf <- mefa(
dxc <- xcount(sscount(fill.count(dol.count), zc="zero.count")),
xorder(dxc, which="samples", dol.sample, 1),
xorder(dxc, which="species", landsnail, 2)
)

dmf

plot(dmf, "microhabitat", "shell.dimension")

Run the code above in your browser using DataLab