applySpeclib: Apply function for class Speclib

apply.SpeclibR Documentation

Apply function for class Speclib

Description

Apply function over all spectra or a subset of spectra in a Speclib.

Usage

  ## S4 method for signature 'Speclib'
apply(X, FUN, bySI = NULL, ..., simplify = TRUE)

Arguments

X

Object of class Speclib

FUN

Function to be applied. Matched with match.fun.

bySI

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

...

Further arguments passed to FUN.

simplify

Currently ignored.

Value

Object of class Speclib.

Author(s)

Lukas Lehnert

See Also

apply, match.fun, Speclib

Examples

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, bySI = "season")
plot(mean_spectra[1, ], ylim = c(0,50))
plot(mean_spectra[2, ], new = FALSE)
SI(mean_spectra)


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