Description Usage Arguments Details Note Author(s) See Also Examples
Extract parts of an object. Currently, a replace method is not implemented!
1 2 3 4 |
x |
|
i, j, ... |
Elements to extract or replace. |
drop |
Not used. The method will always return a valid |
value |
|
If only one plot is requested for indexing (e.g. x[1,]) the
summary and show methods additionally print a species list.
Any doubled numerical indices are silently ignored.
When objects of class VegsoupPartition are subsetted it is likely that
the partitioning vector (partitioning(obj)) has to be subsetted too.
If this is the case, the number of partitions k (getK(obj)) is
changed (lowered) accordingly.
Roland Kaiser
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 | require(vegsoup)
data(barmstein)
x <- barmstein
# index the species matrix and get new objects
# select rows, the plots
# first two plots
x[ 1:2, ]
# select columns (the species) including layer replicates
# 10 random species
x[ , sample(ncol(x), size = 10) ]
# note, sample may result in an object that holds less then 'size' species
# because of layer replication
# remove species with equal or less than three occurences,
# exact if there is no layer replication
x[, colSums(x) >= 3]
any(colSums(x[, colSums(x) >= 3]) < 3)
# assigment using object slots
rownames(x)
sites(x) <- sites(x)[ sample(nrow(x)), ]
rownames(x)
# extract partitions
x <- VegsoupPartition(x, k = 3)
# extract partition 1
partition(x, 1)
# drop partition 2 and 3
partition(x, -c(2,3))
# extract partition 2 and 3
partition(x, c(2,3))
# as above using logical index vector
partition(x, c(FALSE, TRUE, TRUE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.