10 lines or less: USDA Livestock Output

It seems I have been visiting some government statistics websites more and more frequently lately. Websites like the Bureau of Justice Statistics or the Bureau of Labor Statistics, though somewhat difficult to navigate, are great resources for exciting data for someone looking for something to do on the weekend. The world is your oyster. Since I have been messing with those datasets recently (Justice statistics post to come early next week) I wanted to find something different. Enter the USDA Economic Research Service with data on Agricultural Productivity in the US.

I decided it would be a nice exercise if I limited myself to only 10 lines or less. This could be interpreted differently so I operated on the idea that the operational part had to be 10 lines, not packages or setting up the environment. It turned out to be a little harder than I thought. My first objective was to find and manipulate the data. I decided at the start that the data had to be harvested and tidied in R, sort of like starting from scratch. So using rvest I imported the data from the USDA. Originally I planned on comparing output and input prices in the US, but I was eating my breakfast while doing this so I found the livestock outputs… topical. The result is not super exciting, but a fun and challenging first go at this thing.

#begin stuff
livestock<-read.csv('https://www.ers.usda.gov/webdocs/DataFiles/Agricultural_Productivity_in_the_US__17966/table01a.csv?v=42352',skip=1,stringsAsFactors = F)
  theme_awhstin()+ #you will have to change your theme
  theme(axis.text.x = element_text(angle=90))+
  labs(x='',y='',title='US Livestock Production',
       subtitle='Output Quantity of Livestock Products from 1948-2013',
       caption='Source: USDA, Economic Research Service,\nProductivity in the United States data product, updated December 2015.')