[This article was first published on R Tricks – Data Science Riot!, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
No matter how many jobs are promised, Barak Obama’s administration will be nearly impossible to beat when it comes to employment growth. The following code uses the blcrapeR package, which is available on CRAN.
Politicians talk a lot about jobs and unemployment, even though the actual power they have over the labor market is up for debate. Before you comment, please know I have no interest in politics, but ggplot2 is my friend!
library(blscrapeR) df <- bls_api(c("LNS12000000", "LNS13000000", "LNS14000000"), startyear = 2008, endyear = 2017) %>% # Add time-series dates dateCast() # Plot employment level library(ggplot2) gg1200 <- subset(df, seriesID=="LNS12000000") library(ggplot2) ggplot(gg1200, aes(x=date, y=value)) + geom_line() + labs(title = "Employment Level - Civ. Labor Force")
# Plot unemployment level gg1300 <- subset(df, seriesID=="LNS13000000") library(ggplot2) ggplot(gg1300, aes(x=date, y=value)) + geom_line() + labs(title = "Unemployment Level - Civ. Labor Force")
gg1400 <- subset(df, seriesID=="LNS14000000") library(ggplot2) ggplot(gg1400, aes(x=date, y=value)) + geom_line() + labs(title = "Unemployment Rate - Civ. Labor Force")
To leave a comment for the author, please follow the link and comment on their blog: R Tricks – Data Science Riot!.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.