binning {prospectr} | R Documentation |
Compute average values of a signal in pre-determined bins (col-wise subsets). The bin size can be determined either directly or by specifying the number of bins. Sometimes called boxcar transformation in signal processing
binning(X,bins,bin.size)
X |
numeric |
bins |
number of bins |
bin.size |
desired size of the bins |
a matrix
or vector
with average values per
bin
Antoine Stevens & Leonardo Ramirez-Lopez
sgolayfilt
,
savitzkyGolay
, movav
,
gapDer
, continuumRemoval
data(NIRsoil) spc <- 1/10^NIRsoil$spc # conversion to reflectance wav <- as.numeric(colnames(spc)) matplot(wav,t(spc[1:5,]),type='l',xlab='Wavelength /nm',ylab='Reflectance') # 5 first spectra binned <- binning(spc,bin.size=20) matpoints(as.numeric(colnames(binned)),t(binned[1:5,]),pch=1:5) # bin means binned <- binning(spc,bins=20) dim(binned) # 20 bins matplot(wav,t(spc[1:5,]),type='l',xlab='Wavelength /nm',ylab='Reflectance') # 5 first spectra matpoints(as.numeric(colnames(binned)),t(binned[1:5,]),pch=1:5) # bin means