Description Usage Arguments Details Value Author(s) See Also Examples
Deparse the layer replications (pseudo-species) used as colnames
in the
species matrix of Vegsoup*
objects into it's components.
1 2 3 4 |
obj |
|
x |
|
The splitAbbr
method decomposes the colnames
of the species
matrix into three components. The first giving the taxon abbreviation only
(abbr
), the second the layer code (layer
) and the last
component corresponds to the full taxon name (taxon
) as queried
from taxonomy(obj)
.
The compound taxon key (abbr.layer
) can be accessed from the
rownames
of the resulting object. This is advantageous as it provides
an easy means of subsetting with colnames(obj)
.
decode
is equivalent to the above method, but works for base
classes (see ‘Examples’). However, an appropriate
Vegsoup
or Taxonomy
object
has to be supplied to query scientific taxon names.
Vegsoup
and Species
construct these
compound taxon abbreviations by pasting make.names(x)
and
layer
seperated with "@"
. To deparse the abbreviation and
layer string splitAbbr
should be used.
A "data.frame"
with as many rows and in the same order as there are
columns in the species matrix. Note, the method uses invisible
when
returning it's results.
Roland Kaiser
Vegsoup
Taxonomy
taxalist
taxon
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | require(vegsoup)
data(barmstein)
x <- barmstein
# deparse compund taxon and layer replicates
a <- splitAbbr(x)
head(a)
all.equal(rownames(a), colnames(x))
# get scientific taxa names for the columns of the species matrix
# as.matrix returns a species matrix from an 'Vegsoup' object
# we use mode = "R" for instantaneous matrix transposition
m <- as.matrix(x, typeof = "character", mode = "R")
head(a[rownames(m), ])
# for a unique list of taxa
taxon(x)
# similar result but a matrix
head(taxalist(x, layered = TRUE))
# species matrix including taxon names and layers
m <- cbind(a[rownames(m), ], m)
# and this can be converted bach to class 'Species'
( stackSpecies(m) )
# indexing of 'Vegsoup' object by suppling indices of the the species matrix
# elements according to 'as.matrix' method
x[, rownames(a)[sample(1:ncol(x), 10)]]
# decode rownames of matrix ...
class(xx <- constancy(x))
decode(xx, x)
rownames(xx) <- apply(sapply(decode(xx, x)[c("taxon", "layer")], paste), 1, paste, collapse = "@")
head(xx)
# ... data.frame and Taxonomy object
class(xx <- splitAbbr(x))
decode(xx, taxonomy(x))
# character vector without layer encoded with '@'
decode(taxalist(x)$abbr, x)
# a named list
decode(spread(VegsoupPartition(x, k = 2)), x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.