Subsets various object types based on a given vector or grep partial matching of data names.

# S3 method for rspec
subset(x, subset, ...)

# S3 method for colspace
subset(x, subset, ...)

# S3 method for vismodel
subset(x, subset, ...)

Arguments

x

(required) an object of class rspec, vismodel, or colspace, containing spectra, visual model output or colorspace data to subset.

subset

a string used for partial matching of observations.

...

additional attributes passed to grep. Ignored if subset is logical.

Value

a subsetted object of the same class as the input object.

Note

if more than one value is given to subset, any spectra that matches either condition will be included. It's a union, not an intersect.

Examples

# NOT RUN {
data(sicalis)
vis.sicalis <- vismodel(sicalis)
tcs.sicalis <- colspace(vis.sicalis, space = 'tcs')

# Subset all 'crown' patches (C in file names)
head(subset(sicalis, "C"))
subset(vis.sicalis, "C")
subset(tcs.sicalis, "C")[, 1:5]
subset(sicalis, c("B","C"))
subset(sicalis, "T", invert=TRUE)
# }