spc-bin: Wavelength Binning In order to reduce the spectral resolution...

Description Usage Arguments Details Value Author(s) Examples

Description

The mean of every by data points in the spectra is calculated.

Usage

1
spc.bin(spc, by = stop("reduction factor needed"), na.rm = TRUE, ...)

Arguments

spc

the hyperSpec object

by

reduction factor

na.rm

decides about the treatment of NAs:

if FALSE or 0, the binning is done using na.rm = FALSE

if TRUE or 1, the binning is done using na.rm = TRUE

if 2, the binning is done using na.rm = FALSE, and resulting NAs are corrected with mean(...{}, na.rm = TRUE).

...

ignored

Details

Using na.rm = TRUE always takes about twice as long as na.rm = FALSE.

If the spectra matrix does not contain too many NAs, na.rm = 2 is faster than na.rm = TRUE.

Value

A hyperSpec object with ceiling (nwl (spc) / by) data points per spectrum.

Author(s)

C. Beleites

Examples

1
2
3
4
5
6
7
spc <- spc.bin (flu, 5)

 plot (flu[1,,425:475])
 plot (spc[1,,425:475], add = TRUE, col = "blue")

 nwl (flu)
 nwl (spc)

Example output

Loading required package: lattice
Loading required package: grid
Loading required package: ggplot2
Package hyperSpec, version 0.99-20180627

To get started, try
   vignette ("hyperspec")
   package?hyperSpec 
   vignette (package = "hyperSpec")

If you use this package please cite it appropriately.
   citation("hyperSpec")
will give you the correct reference.

The project homepage is http://hyperspec.r-forge.r-project.org


Warning message:
In spc.bin(flu, 5) : Last data point averages only 1 points.
[1] 181
[1] 37

hyperSpec documentation built on May 2, 2019, 5:45 p.m.