
Retrieving Data From BLS Text File Database
Using
get_bls_data()
from {econanalyzr}
package.
Source: vignettes/get-bls.Rmd
get-bls.Rmd
Introduction
This vignette describes the use of the get_bls_data()
function. This is a wrapper around [httr2::request()] from the httr2 package that also prompts you
to supply a valid email address in the user-agent
HTTPS
header as is now required by the BLS per their terms of use.
Retrieving data
A valid URL to a BLS flat/text file database must be supplied as well as a valid email to retrieve data. This example uses data from the BLS Current Employment Statistics
valid_email <- "you@example.com"
# Link to employment data for the Government sector
bls_url <- "https://download.bls.gov/pub/time.series/ce/ce.data.90a.Government.Employment"
df <- get_bls_data(
bls_url = bls_url,
email = valid_email
)