The inexorable growth of student debt, charted with R

August 15, 2016

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

Len Kiefer, Deputy Chief Economist at Freddie Mac, recently published the following chart to his personal blog showing household debt in the United States (excluding mortgage debt). As you can see, student loan debt has steadily increased over the last 13 years and has now eclipsed all other forms of non-mortgage debt:

Student debt

He also created this animated chart showing the growth (and occasional decline) of all forms of debt (including mortgages). All categories are scaled to the same nominal value in March 2003, and since that time student debt in the US has more than quintupled.

Debt balances 2016Q2

Both charts were created using the R language (the code is included in the blog post linked below). The data come from the New York Federal Reserve, which Robert reads into R using fread from the data.table package. The line charts were created using the ggplot2 package, with the ggrepel extension to keep the labels from overlapping. The animated version was created using the saveGIF function of the animation package.

For more charts (including some interesting by-state charts) and the complete details on the implementation, follow the link to Len's blog below.

Len Kiefer: Consumer Credit Trends (via Sharon Machlis)

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