In order to reduce the spectral resolution and thus gain signal to noise ratio or to reduce the dimensionality of the spectral data set, the spectral resolution can be reduced.
spc_bin(spc, by = stop("reduction factor needed"), na.rm = TRUE, ...)
spc | The |
---|---|
by | Reduction factor. |
na.rm | decides about the treatment of
|
... | Ignored. |
A hyperSpec
object with
ceiling(nwl(spc)/by)
data points per spectrum.
The mean of every by
data points in the spectra is calculated.
Using na.rm = TRUE
always takes about twice as long as na.rm = FALSE
.
If the spectra matrix does not contain too many NA
s, na.rm = 2
is
faster than na.rm = TRUE
.
C. Beleites
spc <- spc_bin(flu, 5)#> Warning: Last data point averages only 1 point.#> [1] 181#> [1] 37