(This article was first published on Milk Trader, and kindly contributed to R-bloggers)
To chart the spread between 2-Year treasury yields and 10-Year treasury yields, please type the simple code listed below into your R console. That is all, carry on as you were.require(quantmod)
getSymbols(c("DGS10", "DGS2"), src="FRED")
Ten_Two <- DGS10-DGS2
chartSeries(Ten_Two)
To leave a comment for the author, please follow the link and comment on his blog: Milk Trader.
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,ecdf, trading) and more...

Zero Inflated Models and Generalized Linear Mixed Models with R.
Zuur, Saveliev, Ieno (2012).