Tidyer BLS data with the blscarpeR package
This article is originally published at https://www.datascienceriot.com/
The recent release of the blscrapeR package brings the “tidyverse” into the fold. Inspired by my recent collaboration with Kyle Walker on his excellent tidycensus package, blscrapeR has been optimized for use within the tidyverse as of the current version 3.0.0.
New things you’ll notice right away include:
All data now returned as tibbles.
dplyr and purrr are now imported packages, along with magrittr and ggplot, which were imported from the start.
No need to call any packages other than tidyverse and blscrapeR.
Major internal changes
Switched from base R to dplyr in instances where performance could be increased.
Standard apply functions replaced with purrr
map()
functions where performance could be increased.
The BLS: More than Unemployment
The American Time Use Survey is one of the BLS’ more interesting data sets. Below is an API query that compares the time Americans spend watching TV on a daily basis compared to the time spent socializing and communicating.
It should be noted, some familiarity with BLS series id numbers is required here. The BLS Data Finder is a nice tool to find series id numbers.
Unemployment Rates
The main attraction of the BLS are the monthly employment and unemployment data. Below is an API query and plot of three of the major BLS unemployment rates.
U-3: The “official unemployment rate.” Total unemployed, as a percent of the civilian labor force.
U-5: Total unemployed, plus discouraged workers, plus all other marginally attached workers, as a percent of the civilian labor force plus all marginally attached workers.
U-6: Total unemployed, plus all marginally attached workers, plus total employed part time for economic reasons, as a percent of the civilian labor force plus all marginally attached workers.
For more information and examples, please see the package vignettes.
Thanks for visiting r-craft.org
This article is originally published at https://www.datascienceriot.com/
Please visit source website for post related comments.