I’ve been this week trying to import some spectra to ChemoSpec (R Package), at the beginning I had problems generating the “csv” files, and the function getManyCsv did not recognize the files. I did not have properly configured the regional settings in the Control Panel, so I had to configure the column separator correctly, after that the function:
>getManyCsv(gr.crit = c("oliv", "sflw"),gr.cols = c("red3", +"dodgerblue4"), freq.unit = "nm",int.unit = "absorbance",
+ descrip = "oil", out.file = "oil")
generates the oil.RData in my working directory.
I wanted to plot my spectra, but I had problems plotting the data.Hopefully Pof. Bryan Hanson (Author of the Package) told me my mistake (frequency values were as integers), so after changing to numeric I could see finally the spectra. (Thanks Bryan)
The spectra are: one olive oil sample and one sunflower oil sample.
The plot spectra function has the option to add an offset and to see the spectra separated:
plotSpectra(oil, title = "olive/sunflower oil", which = 1:2, offset = 0.3)
If we remove the offset we will see that the spectra is similar in the NIR region, but now it is important to lokk carefully to the intensity and the wavelength position of the bands to see the diferences, but this will be treated in another post practicing "ChemoSpec".
The noise in the region from 2200nm to 2500 is due that the sample has been analyzed with a glass vial of 8 mm path length so this region must be discarded from the calibration/identification/qualification.
Clearly we can see the differences between the two oil samples. Sunflower oil is refined, so its spectrum is almost flat in the region from 400 to 1100 nm.
Virgin Olive oil has information in that region.
plotSpectra(oil, title = "olive/sunflower oil", which = 1:2)
If we remove the offset we will see that the spectrais similar in the NIR region, but now it is important the intensity and the wavelength position of the bands to see the diferences, but this will be treated in another post practicing "ChemoSpec".