applySpeclib: Apply function for class Speclib

Description Usage Arguments Value Author(s) See Also Examples

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)

hsdar documentation built on May 30, 2017, 6:23 a.m.

Search within the hsdar package
Search all R packages, documentation and source code