Learn R Programming

pavo (version 1.0.0)

procspec: Process spectra

Description

Applies normalization and/or smoothing to spectra for further analysis or plotting.

Usage

procspec(rspecdata, opt = c("none", "smooth", "maximum", "minimum", "bin", "sum", "center"), fixneg = c("none", "addmin", "zero"), span = 0.25, bins = 20, ...)

Arguments

rspecdata
(required) a data frame, possibly an object of class rspec, with a column with wavelength data, named 'wl', and the remaining column containing spectra to process.
opt
what type of processing options to apply. User can select multiple options by providing a vector. Possibilites are:
  • "none" does not perform any processing (default).
  • "smooth" applies LOESS smoothing to each spectrum using loess.smooth. Optimal smoothing parameter can be assessed by using plotsmooth.
  • "minimum" subtracts the minimum from each individual spectra.
  • "maxmimum" divides each spectrum by its maximum value.
  • "sum" divides each spectrum by summed values.
  • "bin" bins each spectrum into specified wavelength ranges. User should specify.
  • "center" centers individual spectra by subtracting mean reflectance from all values.
fixneg
how to handle negative values. Possibilities are:
  • "none" does not perform negative value correction (default).
  • "zero" sets all negative values to zero.
  • "addmin" adds the absolute value of the maximally negative values of each spectra to the reflectance at all other wavelengths (setting the minimum value to zero, but scaling other values accordingly).
span
sets the smoothing parameter used by loess.smooth.
bins
sets the number of equally sized wavelength bins for opt = "bin".
...
ignored.

Value

A data frame of class rspec with the processed data.

References

Cuthill, I., Bennett, A. T. D., Partridge, J. & Maier, E. 1999. Plumage reflectance and the objective assessment of avian sexual dichromatism. The American Naturalist, 153, 183-200.

Montgomerie R. 2006. Analyzing colors. In Hill, G.E, and McGraw, K.J., eds. Bird Coloration. Volume 1 Mechanisms and measuremements. Harvard University Press, Cambridge, Massachusetts.

See Also

loess.smooth

Examples

Run this code
## Not run: 
# data(teal)
# plot(teal, select = 10)
# 
# # Smooth data to remove noise
# teal.sm <- procspec(teal, opt = 'smooth', span = 0.25)
# plot(teal.sm, select = 10)
# 
# # Normalize to max of unity
# teal.max <- procspec(teal, opt = c('max'), span = 0.25)
# plot(teal.max, select = 10)
# ## End(Not run)

Run the code above in your browser using DataLab