This package contains a data.frame called ?df_state_unemployment
which contains unemployment data on US States from 2000-2014. The data is annualized, which means that there is one data point per State per year:
library(rUnemploymentData) data(df_state_unemployment) ?df_state_unemployment head(df_state_unemployment)
The data was scraped from the US Bureau of Labor Statistics (BLS) Local Area Unemployment Statistics (LAUS) webpage on January 4, 2014 (http://www.bls.gov/lau/) with the function ?build_state_df
.
The easiest way to visualize the entire dataset is with a boxplot.
?boxplot boxplot(df_state_unemployment[, -1], main="USA State Unemployment Data", xlab="Year", ylab="Percent Unemployment")
This visualization shows you, by year, the distribution of the unemployment rate in each state. For example, the recession that began in 2009 is very clear in this graph.
This package also comes with a function to create choropleth maps of the data:
?state_unemployment_choropleth state_unemployment_choropleth(year=2013)
Choropleth maps are useful for understanding the geographic distribution of values. For example, in this map it is clear that the lowest unemployment rates were in the northern central states.
A third option for visualizing the data is with an animated choropleth map:
?animated_state_unemployment_choropleth # animated_state_unemployment_choropleth()
This function is commented out in the above example because the resulting image cannot render inside a vignette. If you are interested in this visualization, then please type the command locally. Note that it will write files to your local file system - see ?choroplethr_animate
in the choroplethr package for details.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.