# take spectra from carbs dataset
data(carbs)
spectra = mda.t(carbs$S)
# apply the correction
pspectra = prep.alsbasecorr(spectra, plambda = 3, p = 0.01)
# show the original and the corrected spectra individually
par(mfrow = c(3, 1))
for (i in 1:3) {
mdaplotg(list(
original = mda.subset(spectra, i),
corrected = mda.subset(pspectra, i)
), type = "l", col = c("black", "red"), lwd = c(2, 1), main = rownames(spectra)[i])
}
Run the code above in your browser using DataLab