Learn R Programming

hsdar (version 0.5.1)

subset.speclib: Subsetting speclibs

Description

Return subsets of Speclibs which meet conditions.

Usage

"subset"(x, subset, ...)

Arguments

x
Object of class 'Speclib'.
subset
Logical expression indicating spectra to keep: missing values are taken as false. See details section.
...
Further arguments passed to agrep.

Value

Object of class Speclib.

Details

Matchable objects are attributes data. Use column names to identify the respectrive attribute. See attribute to access attributes of a Speclib. IDs of spectra may be accessed using "id.speclib" as variable name.

See Also

Speclib, attribute

Examples

Run this code

data(spectral_data)

## Return names of attributes data
names(attribute(spectral_data))

## Devide into both seasons
sp_summer <- subset(spectral_data, season == "summer")
sp_spring <- subset(spectral_data, season == "spring")

## Plot both speclibs
plot(sp_summer, col="darkgreen")
plot(sp_spring, col="darkred", new=FALSE)

Run the code above in your browser using DataLab