# NOT RUN {
data(NIRsoil)
wav <- as.numeric(colnames(NIRsoil$spc))
# conversion to reflectance
spc <- 1/10^NIRsoil$spc
opar <- par(no.readonly = TRUE)
par(mfrow = c(2,1), mar = c(4, 4, 2, 2))
#plot of the 10 first spectra
matplot(wav, t(spc[1:10,]),
type = 'l',
xlab = '',
ylab = 'Reflectance')
mtext('Raw spectra')
det <- detrend(spc, wav)
matplot(wav, t(det[1:10,]),
type = 'l',
xlab = 'Wavelength /nm',
ylab = 'Reflectance')
mtext('Detrend spectra')
par(opar)
# }
Run the code above in your browser using DataLab