Learn R Programming

photobiology (version 0.9.6)

trim_wl: Trim head and/or tail of a spectrum

Description

Triming of head and tail of a spectrum based on wavelength limits, interpolation used by default. Expansion is also possible.

Usage

trim_wl(x, range, use.hinges, fill, ...)

## S3 method for class 'default':
trim_wl(x, range, use.hinges, fill, ...)

## S3 method for class 'generic_spct':
trim_wl(x, range = NULL, use.hinges = TRUE,
  fill = NULL, ...)

## S3 method for class 'generic_mspct':
trim_wl(x, range = NULL, use.hinges = TRUE,
  fill = NULL, ...)

## S3 method for class 'waveband':
trim_wl(x, range = NULL, use.hinges = TRUE,
  fill = NULL, trim = getOption("photobiology.waveband.trim", default =
  TRUE), ...)

## S3 method for class 'list':
trim_wl(x, range = NULL, use.hinges = TRUE, fill = NULL,
  trim = getOption("photobiology.waveband.trim", default = TRUE), ...)

Arguments

x
an R object
range
a numeric vector of length two, or any other object for which function range() will return two
use.hinges
logical, if TRUE (the default) wavelengths in nm.
fill
if fill == NULL then tails are deleted, otherwise tails are filled with the value of fill.
...
not used
trim
logical (default is TRUE which trims the wavebands at the boundary, while FALSE discards wavebands that are partly off-boundary).

Value

  • an R object of same class as input, usually of a different length, either shorter or longer.

Methods (by class)

  • default: Default for generic function
  • generic_spct: Trim an object of class "generic_spct" or derived.
  • generic_mspct: Trim an object of class "generic_mspct" or derived.
  • waveband: Trim an object of class "waveband".
  • list: Trim a list (of "waveband" objects).

See Also

Other trim functions: clip_wl, trim_spct, trim_tails, trim_waveband

Examples

Run this code
trim_wl(sun.spct, range = c(400, 500))
trim_wl(sun.spct, range = c(NA, 500))
trim_wl(sun.spct, range = c(400, NA))

Run the code above in your browser using DataLab