Learn R Programming

TRAMPR (version 1.0-10)

summary.TRAMP: Create Presence/Absence Matrices from TRAMP Objects

Description

Generate a summary of a TRAMP object, by producing a presence/absence matrix. This is the preferred way of extracting the presence/absence matrix from a TRAMP object, and allows for grouping, naming knowns, and ignoring matches (specified by remove.TRAMP.match).

Usage

# S3 method for TRAMP
summary(object, name=FALSE, grouped=FALSE, ignore=FALSE, ...)

Arguments

object

A TRAMP object.

name

Logical: Should the knowns be named?

grouped

Logical: Should the knowns be grouped?

ignore

Logical: Should matches marked as ignored be excluded?

...

Further arguments passed to or from other methods.

Value

A presence/absence matrix, with samples as rows and knowns as columns. If name is TRUE, then names of knowns (or groups of knowns) are used, otherwise the knowns.fk is used (group.strict if grouped). If grouped is TRUE, then the knowns are collapsed by group (using group.strict; see group.knowns). A group is present if any of the knowns belonging to it are present. If ignore is TRUE, then any matches marked by remove.TRAMP.match are excluded.

Examples

Run this code
# NOT RUN {
data(demo.knowns)
data(demo.samples)
res <- TRAMP(demo.samples, demo.knowns)

head(summary(res))
head(summary(res, name=TRUE))
head(summary(res, name=TRUE, grouped=TRUE))

## Extract the species richness for each sample (i.e. the number of
## knowns present in each sample)
rowSums(summary(res, grouped=TRUE))

## Extract species frequencies and plot a rank abundance diagram:
## (i.e. the number of times each known was recorded)
sp.freq <- colSums(summary(res, name=TRUE, grouped=TRUE))

sp.freq <- sort(sp.freq[sp.freq > 0], decreasing=TRUE)
plot(sp.freq, xlab="Species rank", ylab="Species frequency", log="y")
text(1:2, sp.freq[1:2], names(sp.freq[1:2]), cex=.7, pos=4, font=3)
# }

Run the code above in your browser using DataLab