| get_laus | R Documentation |
This function downloads Local Area Unemployment Statistics data from the U.S. Bureau of Labor Statistics. Due to the large size of some LAUS datasets (county and city files are >300MB), users must specify which geographic level to download. The function provides access to both seasonally adjusted and unadjusted data at various geographic levels. Additional datasets provide comprehensive non-seasonally-adjusted data for all areas broken out in 5-year increments
get_laus(
geography = "state_adjusted",
monthly_only = TRUE,
transform = TRUE,
suppress_warnings = TRUE,
return_diagnostics = FALSE,
cache = check_bls_cache_env()
)
geography |
Character string specifying the geographic level and adjustment type. Default is "state_adjusted". Valid options are:
|
monthly_only |
Logical. If TRUE (default), excludes annual data (period M13) and creates a date column from year and period. |
transform |
Logical. If TRUE (default), converts rate and ratio measures from percentages to proportions by dividing by 100. Unemployment rates will be expressed as decimals (e.g., 0.05 for 5% unemployment) rather than as whole numbers (e.g. 5). |
suppress_warnings |
Logical. If TRUE (default), suppress individual download warnings and diagnostic messages for cleaner output during batch processing. If FALSE, returns the data and prints warnings and messages to the console. |
return_diagnostics |
Logical. If TRUE, returns a bls_data_collection object with full diagnostics. If FALSE (default), returns just the data table. |
cache |
Logical. Uses USE_BLS_CACHE environment variable, or defaults to FALSE. If TRUE, will download a cached file from BLS server and update cache if BLS server indicates an updated file. |
The function joins data from multiple BLS files:
Main data file (varies by geography selection)
Series definitions (la.series)
Area codes and names (la.area)
Measure definitions (la.measure)
By default, returns a data.table with LAUS data. If return_diagnostics = TRUE, returns a bls_data_collection object containing LAUS data with the following key columns:
BLS series identifier
Year of observation
Time period (M01-M12 for months, M13 for annual)
Employment statistic value (transformed if transform = TRUE)
Date of observation (if monthly_only = TRUE)
Geographic area name
Code indicating area type
Type of measure (unemployment rate, labor force, employment, etc.)
Seasonal adjustment status
## Not run:
# Download state-level seasonally adjusted data (default operation)
laus_states <- get_laus()
# View unemployment rates by state for latest period
unemployment <- laus_states[grepl("unemployment rate", measure_text) & date == max(date)]
# Download unadjusted state data
laus_states_unadjusted <- get_laus(geography = "state_unadjusted")
# Get full diagnostic object if needed
laus_with_diagnostics <- get_laus(return_diagnostics = TRUE)
print_bls_warnings(laus_with_diagnostics)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.