bls_request {blsR}R Documentation

Retrieve Data From the U.S. Bureau Of Labor Statistics API v2

Description

bls_request() will execute queries against the BLS API. Queries are generated using one of the following query-generating functions: query_series(), query_n_series(), query_popular_series(), query_all_surveys(), query_survey_info(), query_latest_observation(). The result is the "Results" block as defined in the API v2 signatures at https://www.bls.gov/developers/api_signature_v2.htm

Usage

bls_request(
  query,
  api_key = NA,
  user_agent = "http://github.com/groditi/blsR",
  process_response = .process_response,
  ...
)

Arguments

query

list generated by one of the query generating functions

api_key

string, only necessary for retrieving multiple series in one request, requesting calculations, or custom time frames and catalog data

user_agent

string, optional

process_response

function, optional. processes the httr response object. The default function will return the JSON payload parsed into a list

...

further arguments will be passed to process_response when called

Value

a list of information returned by the API request

See Also

Other blsR-requests: get_all_surveys(), get_latest_observation(), get_n_series_table(), get_n_series(), get_popular_series(), get_series_tables(), get_series_table(), get_series(), get_survey_info()

Examples

## Not run: 
library(blsR)
uer_query <- query_series('LNS14000000') #monthly unemployment rate series
uer_results <- bls_request(uer_query) #API response

## End(Not run)

[Package blsR version 0.3.0 Index]