(This article was first published on

**NIR-Quimiometría**, and kindly contributed to R-bloggers)I have been in previous post using the ChemoSpec package for some oil data (olive and sunflower). My spectra has now a range from 1100nm to 2200nm and is raw (not treated mathematically) . I want to start using the ChemoSpec package to start using the “Hierarchical Cluster Analysis” in order to see some cluster in my data. Of course I hope to see the olive oil in one cluster and the sunflower in the other. But probably other clusters can appear.

Anyway this is just a quick test and sure we´ll get much better knowledge of the data treating the spectra with derivatives (this will be done in another post).

So after importing the “csv” files into R, we can plot the raw spectra (olive oil in red and sunflower in red).

We can see some ranges of the spectra where there is a clear difference, and we explain in previous post that these differences are related to the fatty acids concentration.

Let´s run the “Hierarchical Cluster Analysis” from ChemoSpec:

hcaSpectra(oils, title = "Raw Spectra / oils")

We can see that 3 samples of sunflower oil are quite different from the others (Olive or sunflower), and that with the rest of the samples there are two cluster (olive and sunflower oil).

We can get some other conclusions, but what I´m going to do is to treat with second derivative the spectra and try to get more conclusions with this set of the spectra at the same time I practice with R.

To

**leave a comment**for the author, please follow the link and comment on his blog:**NIR-Quimiometría**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...