"R": Plotting the spectra (Gasoline) – 002

February 2, 2012

(This article was first published on NIR-Quimiometría, and kindly contributed to R-bloggers)

“R” has a package called “ChemometricsWithR”, where we can get data from different analytical instruments including Near Infrared (NIR).
Follow the steps to plot the spectra of a gasoline data set:
In this other case we plot the spectra of the NIR shootout 2002:

> data(shootout)
> wavelengths<-seq(600, 1898,by=2)
> mattplot(wavelengths,shootout$calibrate.1[1,],xlab=”wavelength(nm)”,ylab=”log1/R)”)

> library(ChemometricsWithR)
> data(gasoline, package=”pls”)
> wavelengths<-seq(900, 1700,by=2)
> matplot(wavelengths,t(gasoline$NIR),lty=1,xlab=”wavelengths(nm)”,ylab=”log(1/R)”)

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...


Comments are closed.


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)