Learn R Programming

photobiology (version 0.9.6)

interpolate_spct: Map a spectrum to new wavelength values.

Description

This function gives the result of interpolating spectral data from the original set of wavelengths to a new one.

Usage

interpolate_spct(spct, w.length.out = NULL, fill = NA, length.out = NULL)

interpolate_mspct(mspct, w.length.out = NULL, fill = NA,
  length.out = NULL)

Arguments

spct
generic_spct
w.length.out
numeric array of wavelengths (nm)
fill
a value to be assigned to out of range wavelengths
length.out
numeric value
mspct
an object of class "generic_mspct"

Value

  • A new spectral object of the same class as argument spct.

Details

If length.out it is a numeric value, then gives the number of rows in the output, if it is NULL, the values in the numeric vector w.length.out are used. If both are not NULL then the range of w.length.out and length.out are used to generate a vector of wavelength. A value of NULL for fill prevents extrapolation. If both w.length.out and length.out are NULL the input is returned as is. If w.length.out has length equal to zero, zero rows from the input are returned.

Examples

Run this code
interpolate_spct(sun.spct, 400:500, NA)
interpolate_spct(sun.spct, 400:500, NULL)
interpolate_spct(sun.spct, seq(200, 1000, by=0.1), 0)
interpolate_spct(sun.spct, c(400,500), length.out=201)

Run the code above in your browser using DataLab