## New functionality
* Managing the API key can now be done via the BLS_API_KEY
environment
variable. This can be done using a .Renviron
file or manually by setting
the key with the new bls_set_key
function. Functions which previously
required the argument api_key
now default to the result of bls_set_key
* get_n_series
and all functions downstream of it now support automatic
spanning of lists of series_ids
longer than the API limit by breaking up
the query into multiple API calls.
## Other Changes
* Function arguments that previously defaulted to NA
now default to NULL
* Major refactor of documentation
## Bug Fixes
* get_latest_observation
's argument was incorrectly named survey_id
instead of series_id
get_n_series
documentation state that ...
was passed to
query_n_series
. This was both inaccurate and inconsistent with the behavior
of the other get_*
functions. get_n_series
arguments were updated to
capture all of the query_n_series
arguments and pass ...
to bls_request
get_n_series
for only 1 series would fail due to a
json encoding issue stemming from a length 1 vector being coerced to a scalar
within httr::POST
in bls_request
.data_as_table
would return a variable number of columns based
on the shape of the input. This led to unpredictable output and caused issues
when merging multiple requests for different time spans. Going forward
data_as_table
will return a tibble with only 4 columns (year
, period
,
periodName
, and value
). Users that wish to access aspects, footnotes,
calculations, or the 'latest' flag should use get_n_series
.data_as_table
, get_series_table
and
get_n_series_table
no longer include the latest
or footnotes
columns.
This fixes a condition where requesting aspects for a series without aspects
would cause the table to have zero rows and a condition where the latest
column could disappear between two identical calls if the data was updated.get_series_table
and get_series_tables
. Pagination
behavior has been renamed to 'spanning', removed from the previous points of
implementation and implemented as three spanning functions following a
map-reduce pattern:span_series_request
- encapsulates all of the spanning behaviorspan_request_queries
- creates multiple conforming queriesreduce_spanned_responses
- merges the results of multiple queries
The spanning behavior is now implemented at get_series
and get_n_series
,
which removes the burden of merging multiple requests from the higher level
get_series_table
and get_n_series_table
functions and allows users to
create their own high-level functions to alter the presentation without having
to be aware of the multiple requests. Spanning behavior may be turned off by
setting the span
argument to FALSE
.get_series_table
or get_series_tables
were called for a
date range and series combination with no observations available, an error was
triggered by data_as_table
failing. Series and period combinations with no
results now return NA
.get_series_table
and get_series_tables
now notify if the request is
broken up into multiple API calls.get_series_tables
now
merges the results descending order to match the order of the returned data.get_series
and get_n_series
now notify if request returns 0 observationsdata_as_table
throws an error if data
argument is empty or not a list.merge_tables
was used applied to tables with different
periods, results were dependent on the order in which tables were arranged-in
on the arguments list due to the use of 'left_join' logic. The updated
implementation will return a row for every period in any of the tables,
making it insensitive to the order of the tables in the input. As a
side-effect of the implementation the resulting table will return the merged
table ordered-by the column(s) in the join_by
argument in ascending order.data_as_table
, get_series_table
, get_series_tables
, and
get_n_series_table
all have new optional parameter "parse_values" which
will cast numeric strings into numeric valuesbls_request
has new optional process_response
argument which gives
users access to the raw API responseget series
documentation improvedtidy_table_as_zoo
for users of zoo
and xts
get_series_table
and get_series_tables
to request more than 20
years of data by making multiple requestsBLS_API_TEST_KEY
env variable is settidy_periods
now puts month and quarter column after yearInitial release
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.