# NOT RUN {
data(NIRsoil)
# conversion to reflectance
spc <- 1/10^NIRsoil$spc
wav <- as.numeric(colnames(spc))
# 5 first spectra
matplot(wav, t(spc[1:5,]),
type = 'l',
xlab = 'Wavelength /nm',
ylab = 'Reflectance')
binned <- binning(spc, bin.size = 20)
# bin means
matpoints(as.numeric(colnames(binned)), t(binned[1:5,]), pch = 1:5)
binned <- binning(spc, bins = 20)
dim(binned) # 20 bins
# 5 first spectra
matplot(wav, t(spc[1:5,]),
type = 'l',
xlab = 'Wavelength /nm',
ylab = 'Reflectance')
# bin means
matpoints(as.numeric(colnames(binned)),
t(binned[1:5,]), pch = 1:5)
# }
Run the code above in your browser using DataLab