xinterp: Resampling of spectra by nterpolation methods

View source: R/xinterp.R

xinterpR Documentation

Resampling of spectra by nterpolation methods

Description

Resampling of spectra (or any signal) by interpolation methods, including linear, spline, and cubic interpolation. Uses interp1 of package signal.

Usage


xinterp(X, w, meth = "cubic", ...)

Arguments

X

A n x p matrix or data frame of spectra (or more generally signals). The names of the columns of X are taken as the wavelengths (or more generally x-values), w0. If these names are missing or as.numeric(colnames(X)) contains NAs, they are automatically set to w0 = 1:p.

w

A vector of the values where to interpolate (typically within the range of w0).

meth

The method of interpolation. See interp1.

...

Optionnal arguments to pass in function splinefun if meth = "spline".

Value

A matrix of the interpolated spectra.

Examples


data(datcass)

X <- datcass$Xu
w <- seq(500, 2400, length = 10)
zX <- xinterp(X, w, meth = "spline")
plotsp(zX)


mlesnoff/rnirs documentation built on April 24, 2023, 4:17 a.m.