predict.specproc_emsc: Apply EMSC to New Spectra

View source: R/emsc.R

predict.specproc_emscR Documentation

Apply EMSC to New Spectra

Description

Corrects new spectra with the reference spectrum, polynomial basis and interferents of a model fitted by emsc().

Usage

## S3 method for class 'specproc_emsc'
predict(object, newdata, ...)

Arguments

object

An object returned by emsc().

newdata

A numeric matrix or data frame of new spectra, with the same variables as the calibration data.

...

Not used.

Value

A tibble of corrected spectra.

See Also

emsc(), predict.specproc_filter()

Examples

data(forageLIBS)
wl <- suppressWarnings(as.numeric(names(forageLIBS)))
spectra <- forageLIBS[which(wl > 760 & wl < 780)]  # the K I resonance lines
fit <- emsc(spectra[1:300, ], degree = 2)
corrected <- predict(fit, spectra[301:368, ])
dim(corrected)

specProc documentation built on Nov. 20, 2026, 5:11 p.m.