blsR {blsR}R Documentation

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


blsR provides functions for retrieving and processing data from the BLS API. The functions are divided into 4 categories: query generators, query requests, result processors, and the user-friendly simplified interface.

API Key and Definition

The API key is an optional parameter, but it is recommended you register for an API key and use it. Requests without a key are limited to 10 years of data per request, 25 series per query, and 25 queries per day. You can register at:

This implementation was based on the signatures available at:

The B.L.S. Frequently asked questions is available at:

General Workflow

This package was designed with a three-step workflow in mind:

You can customize this workflow by creating your own query objects which consist of a target URL and an optional payload as documented in the API Spec. You may also want to create a custom results processor to shape the data to suit individual needs and wrap those into a single call like get_series_table() does.

Query Generators

The query generators return a list suitable for passing to bls_request(). Most users should never need to access these functions directly but they are made available for advanced users and user-extensions.

Query Requests

The query-requester functions will execute the query by making the API request and returning a minimally-processed response. These are likely to be the most suitable functions to use for users who want to access the raw results.

Result Processors

The result-processor functions will transform the raw API response data structures into data structures more likely to be suitable for modern user workflows. The functions generally take as input the values returned by the query-requester functions and make transform the data to different formats or modify the output of another result-processor function.

Simplified Interface

These functions simplify the query generation, execution, and response processing into a single function call, including extended request periods that have to be broken down into multiple API requests. For most common use cases these are likely to be the only functions needed.

[Package blsR version 0.3.0 Index]