View source: R/prep_wav_trim.R
| prep_wav_trim | R Documentation |
Creates a preprocessing constructor for trimming spectral data to a
specified wavelength/wavenumber band. The constructor is intended to be passed to
preprocess_recipe and executed via process.
prep_wav_trim(
band,
trim_constant_edges = FALSE
)
band |
A numeric vector of length 2 giving the minimum and maximum
wavenumber/wavelength to retain. Columns of |
trim_constant_edges |
A logical. If |
Band trimming retains only those columns whose names (coerced to numeric)
fall within [min(band), max(band)]. If no columns fall within the
band the original matrix is returned with a warning.
Constant edge trimming scans inward from each edge and drops columns that are identical to their immediate neighbour or are all zero. If trimming would leave fewer than two columns the step is skipped with a warning.
Because constant edge trimming depends on the data values, it is resolved to
the exact set of wavelengths/wavenumbers retained on the training data when the step is
used in calibrate, so that predictions trim newdata to
exactly the same columns.
An object of class preprocessing to be used in
preprocess_recipe and executed by process.
Claudio Orellano and Leonardo Ramirez-Lopez
preprocess_recipe, process
data("proximateCannabis")
X <- proximateCannabis$spc
tr <- prep_wav_trim(band = c(1000, 1800))
recipe <- preprocess_recipe(tr, device = "proxiscout")
X_trim <- process(X, recipe)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.