xorder {mefa}R Documentation

Makes Object of Class 'xorder'

Description

The function makes an object of class 'xorder' from an attribute table (data frame) based on comparison with an 'xcount' object. Data frame subsetting is made according to results of function check.attrib.

Usage

xorder(xc, which = c("samples", "species"), attrib, index = 0)

## S3 method for class 'xorder':
print(x, ...)

Arguments

xc an object of class 'xcount'.
which switch for rows ("samples") or columns ("species") of the 'xcount' object to be compared according to index.
attrib data frame to be checked.
index column identifier within attrib to be compared according to row/column names (as sample/species identifiers) of the 'xcount' object according to value of which. By default, index = 0, and rownames are taken as identifiers.
x an object of class 'xorder'.
... other arguments.

Value

A result is an object of class 'xorder'.

data data frame, ordered and subsetted according to the 'xcount' object.
call returns the call.
which the value of the which argument, either "samples" or "species".
check.setrel set.relation value of function check.attrib.
na indicates the number of NA values in attrib.

Author(s)

Peter Solymos, Solymos.Peter@aotk.szie.hu, http://www.univet.hu/users/psolymos/personal/

See Also

check.attrib, mefa, xcount

Examples

### 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, "zero.count"))

xo1 <- xorder(xct, "samples", sampletab, 1)
xo2 <- xorder(xct, "species", spectab, 1)

### Example 2: field data of Villany Hills

## Not run: 
data(vtable, vsample, landsnail)

vt <- as.xcount(vtable, FALSE)

spec <- xorder(vt, which="species", landsnail, 2)
spec

sampl <- xorder(vt, which="samples", vsample, 1)
sampl
## End(Not run)

[Package mefa version 1.1-0 Index]