Mean spectrum calculation is important:
To center a matrix of spectra, we subtract the mean spectrum, from every spectrum in the matrix.
There are also many options to use the mean spectrum, like average subsamples.
Let´s calculate and plot the mean spectra for the Yarn NIR Data:
+ xlab="data_points",ylab="mean spec.")