resample: Resample vector, matrix, or spectra

Description Usage Arguments Value

View source: R/resample.R

Description

Convenient wrapper around base R's splinefun and approxfun. See stats::splinefun() and stats::approxfun() documentation for information on different spline methods and additional arguments.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
resample(values, ...)

## Default S3 method:
resample(values, from, to, method = "fmm", ...)

## S3 method for class 'matrix'
resample(values, from, to, ...)

## S3 method for class 'spectra'
resample(values, to, ...)

Arguments

values

Vector or matrix of values, or object of class spectra(). Length of vector, or nrow of matrix must match length of from. For spectra, from argument is omitted because it is taken from wavelengths.

...

Additional arguments to stats::splinefun() or stats::approxfun()

from

X values for interpolation (for spectra objects, this is assumed to be the wavelengths attribute.)

to

Y values onto which to interpolate. For spectra objects, this should be new wavelengths.

method

One of the methods for stats::splinefun() (for polynomial and periodic splines) or stats::approxfun() (for constant or linear). Default is "fmm" (same as splinefun).

Value

Object of the same class as values, resampled to the to values.


ashiklom/PEcAnRTM documentation built on March 7, 2020, 7:46 a.m.