Twos and Tens in Four Lines

February 9, 2011

(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.


getSymbols(c("DGS10", "DGS2"), src="FRED")

Ten_Two <- DGS10-DGS2


To leave a comment for the author, please follow the link and comment on his blog: Milk Trader. 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...

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

Tags: ,

Comments are closed.