Learn R Programming

spectrolab (version 0.0.12)

resample: Resample spectra

Description

resample returns spectra resampled to new bands using spline smoothing. Possible to increase or decrease the spectral resolution.

Usage

resample(x, new_wvls, ...)

# S3 method for spectra resample(x, new_wvls, ...)

Arguments

x

spectra object. bands must be strictly increasing

new_wvls

numeric vector of bands to sample from spectra

...

additional parameters passed to the smooth.spline function.

Value

spectra object with resampled spectra

Methods (by class)

  • spectra: Resample spectra

Details

resample doesn't predict values for bands outside of the original range.

Examples

Run this code
# NOT RUN {
library(spectrolab)
spec = as_spectra(spec_matrix_example, name_idx = 1)
spec = resample(spec, new_wvls = seq(400, 2400, 0.5), parallel = FALSE)
# }

Run the code above in your browser using DataLab