applySpeclib: Apply function for class Speclib

Description

Apply function over all spectra or a subset of spectra

Usage

1
2
## S4 method for signature 'Speclib'
apply(X, FUN, byattributes = NULL, ...)

Arguments

X

Object of class Speclib

FUN

Function to be applied. Matched with match.fun.

byattributes

Character string giving the name of the column in the attributes to be used as subsets to apply function FUN on.

...

Further arguments passed to FUN.

Value

Object of class Speclib.

Author(s)

Lukas Lehnert

See Also

apply, match.fun, Speclib

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(spectral_data)

mean_spectrum <- apply(spectral_data, FUN = mean)
plot(mean_spectrum)

## Same as above but seperately for both seasons
mean_spectra <- apply(spectral_data, FUN = mean, byattributes = "season")
plot(mean_spectra, FUN = 1, ylim = c(0,50))
plot(mean_spectra, FUN = 2, new = FALSE)
attribute(mean_spectra)

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.