apply-methods {hyperSpec} | R Documentation |
Computes summary statistics for the spectra of a hyperSpec
object.
## S4 method for signature 'hyperSpec': apply(X, MARGIN, FUN, ..., label.wl = NULL, label.spc = NULL, new.wavelength = NULL, short = NULL, long = NULL, user = NULL, date = NULL)
X, spc |
a hyperSpec object |
MARGIN |
The subscript which the function will be
applied over. 1 indicates rows, 2 indicates columns,
1:2 indicates that FUN should be applied to all
elements of the spectra matrix.
|
FUN |
function to compute the summary statistics |
... |
further arguments passed to FUN |
label.wl,label.spc |
new labels for wavelength and spectral intensity axes |
new.wavelength |
for MARGIN = 2 : numeric vector or name of the argument in ...
that is to be used (character) as wavelength axis of the resulting object. |
short, long, user, date |
aguments passed to logentry |
apply
gives the functionality of
apply
for hyperSpec
objects.
The generic functions of group Math
are not
definded for hyperSpec
objects. Instead, apply
can be
used. For functions like log
that work on scalars,
MARGIN = 1 : 2
gives the appropriate behaviour.
spcapply
does the same as apply
with MARGIN = 1
,
but additionally allows to set a new wavelength axis and adjust the labels.
wlapply
does the same as apply
with MARGIN = 2
,
but additionally allows to set a new wavelength axis and adjust the labels.
A hyperSpec
object
C. Beleites
apply
, for applying FUN
to subgroups of
the hyperSpec
object: aggregate
.
plot (apply (chondro, 2, range), "spc") plot (apply (chondro, 1, mean), "map") flu[[,,405:407]] apply (flu, 1:2, "*", -1)[[,,405:407]] all (apply (flu, 1:2, log)[[]] - log(flu[[]]) == 0)