An R package for obtaining and cleaning data from the Bureau of Labor Statistics (BLS). This package uses the BLS API.
Simple-to-use functions for downloading data from the most commonly used BLS databases.
Cleans the data returned by the BLS API and converts the data into a panel format.
Supplements the blscrapeR package by converting inputs to BLS series ID strings.
Impelements error checks for BLS database idiosyncracies.
A detailed usage description can be found in the vignette.
This package currently supports the following BLS databases:
Current employment statistics (CES)
Job openings and labor turnover survey (JOLTS)
Local area unemployment statistics (LAUS)
In the near future, this package should also support these additional BLS databases:
Quarterly Census of Employment and Wages (QCEW)
Current Population Survey (CPS)
Consumer Price Index (CPI)
Current Expenditure Survey (CE)
Examples:
library(blscrapeR)
#Download data from CES
# Custom CES state data series
ces_df = ces_download(
bls_key = Sys.getenv("BLS_KEY"),
start_year = 2010,
end_year = 2015,
adjustment = "U",
industries = "05000000",
data_types = c("01", "03", "11"),
states = "1900000"
)
# Pre-built CES seasonally adjusted non-farm payroll series
ces_df = ces_emp(
bls_key = Sys.getenv("BLS_KEY"),
series = "nfp",
start_year = 2010,
end_year = 2015,
adjustment = "S"
)
# Pre-built CES non-seasonally adjusted sector series
ces_df = ces_emp(
bls_key = Sys.getenv("BLS_KEY"),
series = "super",
start_year = 2010,
end_year = 2018,
adjustment = "U"
)
#Download data from JOLTS
# Custom JOLTS hire and quit rates and levels series
jolts_df = jolts_download(
bls_key = Sys.getenv("BLS_KEY"),
start_year = 2010,
end_year = 2015,
adjustment = "S",
industries = "000000",
data_types = c("HI", "QU"),
data_levels = c("R", "L")
)
# Pre-built JOLTS seasonally adjusted non-farm hires series
jolts_df = jolts_hires(
bls_key = Sys.getenv("BLS_KEY"),
series = "nfp",
start_year = 2010,
end_year = 2015,
adjustment = "S"
)
# Pre-built JOLTS non-seasonally adjusted sector separations series
jolts_df = jolts_seps(
bls_key = Sys.getenv("BLS_KEY"),
series = "super",
start_year = 2010,
end_year = 2015,
adjustment = "S"
)
# Local area unemployment statistics
# Custom LAUS data series
laus_df = laus_download(
bls_key = Sys.getenv("BLS_KEY"),
start_year = 2010,
end_year = 2015,
adjustment = "S",
states = c("ST0100000000000", "ST0200000000000"),
data_types = c("03")
)
# Pre-built LAUS seasonally adjusted unemployment rate series
laus_df = laus_urate(
bls_key = Sys.getenv("BLS_KEY"),
start_year = 2010,
end_year = 2015,
adjustment = "S"
)
The blsr package is not available on CRAN. You can install the development version from Github:
library("devtools")
devtools::install_github("davidsovich/blsr")
dsovich AT
uky.edu
March 22, 2019: Developmental release
December 16, 2020: Incorporated changes to JOLTS series ID formats. See press release.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.