[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 add other data set of “sunflower oil” to import together with the olive oil into ChemoSpec R package. Before, as I showed in a video (Preparing spectra to import into ChemoSpec), every sample has been acquired with a NIR instrument (in transmittance) and transformed into a CSV file.

Olive samples are in red, so we can see some differences visually respect to the sunflower oil (blue). Anyway we will zoom some areas of the spectra in order to see better the differences.
We can see an olive oil sample, which is different from the rest. We have the raw spectra, so there are not math treatments applied, or baseline correction.
Let’s see one of the areas (around 1720nm). Oils with high content of polyunsaturated fatty acids have the maximum peak  at 1720nm (in this case the sunflower oil), olive oil (in red) is more reach in monounsaturated fatty acids, so the band moves to the right to a higher frequency (1724 nm aprox.).

plotSpectra(oils, title = “(olive / sunflower) oils”,
which = 1:19,xlim = c(1680,1800))

Other area where we can notice the difference is around 2140 nm where the oils with polyunsaturated fatty acids have a higher intensity than the oils with more monounsaturated fatty acids. (Anyway here one of the samples of olive oil is similar to the sunflower oil. So this sample could be considered as an outlier.
plotSpectra(oils, title = “(olive / sunflower) oils”,
which = 1:19,xlim = c(2100,2200),yrange=c(1.0,1.8))

We can practice the option to remove problematic sample from the manual:
> oils\$names
[1] “oliv149” “oliv202” “oliv255” “oliv305” “oliv358” “oliv44”  “oliv96”
[8] “sflw10”  “sflw11”  “sflw12”  “sflw13”  “sflw2”   “sflw3”   “sflw4”
[15] “sflw5”   “sflw6”   “sflw7”   “sflw8”   “sflw9”

oils1<- removeSample(oils, rem.sam = c("oliv149"))

If we plot now the “oils1” set, the outlier sample will be removed from the plots.

Bibliography: Manual del aceite de oliva ( Ramón Aparicio / John Harwood)

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.

# Never miss an update! Subscribe to R-bloggers to receive e-mails with the latest R posts.(You will not see this message again.)

Click here to close (This popup will not appear again)