subset_speclib: Subsetting speclibs

subset.speclibR Documentation

Subsetting speclibs

Description

Function to return subsets of Speclibs by defined conditions.

Usage

## S4 method for signature 'Speclib'
subset(x, subset, ...)

Arguments

x

Object of class 'Speclib'.

subset

Logical expression indicating spectra to keep: missing values are taken as false. Multiple expressions can be applied using logical operators AND and OR. See details section.

...

Further arguments passed to agrep.

Details

Matchable objects are SI data. Use column names to identify the respective SI. See SI to access SI of a Speclib. IDs of spectra may be accessed using "id.speclib" as variable name. To subset certain wavelength ranges of a Speclib refer to mask.

Value

Object of class Speclib.

Author(s)

Lukas Lehnert, Wolfgang Obermeier

See Also

Speclib, SI, mask

Examples



data(spectral_data)

## Return names of SI data
names(SI(spectral_data))

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

## Divide into both seasons and years
sp_summer_14 <- subset(spectral_data, season == "summer" & year == 2014)
sp_spring_14 <- subset(spectral_data, season == "spring" & year == 2014)

## Plot all speclibs
plot(sp_spring_14, col="green", ylim = c(0,80))
plot(sp_summer_14, col="red", new = FALSE)



hsdar documentation built on March 18, 2022, 6:35 p.m.