`[` Subsets spectra by sample names (rows) or (and) bands (columns)
Usage
# S3 method for spectra
[(x, i, j, simplify = TRUE)
Value
usually a spectra object, but see param `simplify`
Arguments
x
spectra object
i
Sample names (preferred), index, or a logical vector of length nrow(x)
j
band labels, as numeric or character
or a logical vector of length ncol(x). Do not use indexes!
simplify
Boolean. If TRUE (default), single band selections
are returned as a named vector of values
Author
Jose Eduardo Meireles
Details
Subset operations based on samples (first argument) will match sample
names or indexes, in that order. The spectra constructor ensures that names are
not numeric nor are coercible to numeric, such that x[1:2, ] will return the
first and second samples in the `spectra` object. Subsetting based on bands
(second argument) matches the band labels, not indices! That is, x[ , 600]
will give you the value data for the 600nm band and not the 600th
band. Boolean vectors of the appropriate length can be used to subset samples
and bands.