R functions for the chemometric analysis of spectra