TRAMPindexing {TRAMPR} | R Documentation |
Index (Subset) TRAMPsamples and TRAMPknowns Objects
Description
This provides very basic support for subsetting
TRAMPsamples
and TRAMPknowns
objects.
Usage
## S3 method for class 'TRAMPknowns'
x[i, na.interp=TRUE, ...]
## S3 method for class 'TRAMPsamples'
x[i, na.interp=TRUE, ...]
Arguments
x |
A |
i |
A vector of |
na.interp |
Logical: Controls how |
... |
Further arguments passed to or from other methods. |
Details
When indexing by logical vectors, NA
values do not make valid
indexes, but may be produced when testing columns that contain missing
values, so these must be converted to either TRUE
or
FALSE
. If i
is a logical index that contains missing
values (NA
s), then na.interp
controls how they will be
interpreted:
If
na.interp=TRUE
, thenTRUE, FALSE, NA
becomesTRUE, FALSE, TRUE
.If
na.interp=FALSE
, thenTRUE, FALSE, NA
becomesTRUE, FALSE, FALSE
.
Warning
For TRAMPknowns
objects, if the file.pat
element is
specified as part of the object (see TRAMPknowns
), then
the subsetted TRAMPknowns
object will be written to a file.
This may not be what you want, so it is probably best to disable
knowns writing by doing x$file.pat <- NULL
before doing any
subsetting (where x
is the name of your TRAMPknowns
object).
Examples
data(demo.samples)
data(demo.knowns)
## Subsetting by sample.fk values
labels(demo.samples)
demo.samples[c(101, 102, 110)]
labels(demo.samples[c(101, 102, 110)])
## Take just samples from the first 10 soilcores:
demo.samples[demo.samples$info$soilcore.fk <= 10]
## Indexing also works on TRAMPknowns:
demo.knowns[733]
labels(demo.knowns[733])