data(NIRsoil)
NIRsoil$msc_spc <- msc(X = NIRsoil$spc)
# 10 first msc spectra
matplot(
x = as.numeric(colnames(NIRsoil$msc_spc)),
y = t(NIRsoil$msc_spc[1:10, ]),
type = "l",
xlab = "wavelength, nm",
ylab = "msc"
)
# another example
spectra_a <- NIRsoil$spc[1:40, ]
spectra_b <- NIRsoil$spc[-(1:40), ]
spectra_a_msc <- msc(spectra_a, colMeans(spectra_a))
# correct spectra_a based on the reference spectrum used to correct
# spectra_a
spectra_b_msc <- msc(
spectra_b,
ref_spectrum = attr(spectra_a_msc, "Reference spectrum")
)
Run the code above in your browser using DataLab