Learn R Programming

tidyusmacro (version 0.1.0)

getBLSFiles: Download and Process BLS Time Series Files with Vectorized Date Assignment

Description

This function downloads and processes data from the Bureau of Labor Statistics (BLS) for a given data source. It downloads several auxiliary files, merges them to enrich series metadata, downloads the main data file, and assigns dates based on the period code. For monthly data (codes "M01"–"M12") the date is set to the first day of the month; if the period is "M13", the date is set to December 31; and for quarterly data (codes "Q1"–"Q4") the date is assigned as the last day of the quarter's final month.

Usage

getBLSFiles(data_source, email)

Value

A tibble containing the merged BLS data with an assigned date column.

Arguments

data_source

A character string specifying the data source. One of "cpi", "eci", "jolts", "cps", "ces", "averageprice", or "food".

email

A character string containing your email address. This is used as the HTTP user agent when downloading files.

Examples

Run this code
# \donttest{
  # Download CPI data using your email address
  bls_data <- getBLSFiles("cpi", "user@example.com")
# }

Run the code above in your browser using DataLab