trim_wl: Trim head and/or tail of a spectrum

Description Usage Arguments Value Methods (by class) Note See Also Examples

View source: R/spct.trim.r

Description

Trim head and tail of a spectrum based on wavelength limits, with interpolation at range boundaries used by default. Expansion is also possible.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
trim_wl(x, range, use.hinges, fill, ...)

## Default S3 method:
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,
  ...,
  .parallel = FALSE,
  .paropts = 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 Flag indicating whether to insert "hinges" into the spectral data before integration so as to reduce interpolation errors at the boundaries of the wavebands.

fill

if fill == NULL then tails are deleted, otherwise tails are filled with the value of fill.

...

ignored (possibly used by derived methods).

.parallel

if TRUE, apply function in parallel, using parallel backend provided by foreach

.paropts

a list of additional options passed into the foreach function when parallel computation is enabled. This is important if (for example) your code relies on external data or packages: use the .export and .packages arguments to supply them so that all cluster nodes have the correct environment set up for computing.

trim

logical (default is TRUE which trims the wavebands at the boundary, while FALSE discards wavebands that are partly off-boundary).

Value

A copy of x, usually trimmed or expanded to a different length, either shorter or longer. Possibly with some of the original spectral data values replaced with fill.

Methods (by class)

Note

By default the w.length values for the first and last rows in the returned object are the values supplied as range.

trim_wl when applied to waveband objects always inserts hinges when trimming.

trim_wl when applied to waveband objects always inserts hinges when trimming.

See Also

Other trim functions: clip_wl(), trim_spct(), trim_waveband()

Examples

1
2
3
trim_wl(sun.spct, range = c(400, 500))
trim_wl(sun.spct, range = c(NA, 500))
trim_wl(sun.spct, range = c(400, NA))

photobiology documentation built on Aug. 28, 2020, 1:11 a.m.