Site icon R-bloggers

My first "ChemoSpec" spectra

[This article was first published on NIR-Quimiometría, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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”.

To leave a comment for the author, please follow the link and comment on their blog: NIR-Quimiometría.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.