resample | R Documentation |
Resample a data matrix or vector to new coordinates (e.g.
band positions) using spline or linear interpolation. This function is a
simple wrapper around approx
and splinefun
in
base.
resample(X, wav, new.wav, interpol = "spline", ...)
X |
numeric matrix or vector to resample (optionally a data frame that can be coerced to a numerical matrix). |
wav |
a numeric vector giving the original band positions. |
new.wav |
a numeric vector giving the new band positions. |
interpol |
the interpolation method: 'linear' or 'spline' (default). |
... |
additional arguments to be passed to the |
a matrix or vector with resampled values.
Antoine Stevens and Leonardo Ramirez-Lopez
resample2
data(NIRsoil)
wav <- as.numeric(colnames(NIRsoil$spc))
# increase spectral resolution by 2
NIRsoil$spc_resampled <- resample(NIRsoil$spc, wav, seq(1100, 2498, 2))
dim(NIRsoil$spc)
dim(NIRsoil$spc_resampled)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.