├── .gitattributes ├── .gitignore ├── DESCRIPTION ├── NAMESPACE ├── R ├── LAUS_AreaCodes.R ├── apiDF.R ├── blsAPI.R ├── blsQCEW.R ├── help_laus_areacodes.R ├── laus_get_areacode.R ├── laus_get_data.R ├── laus_get_measure.R └── laus_measure.R ├── README.md ├── data ├── LAUS_AreaCodes.RData └── laus_measure.RData ├── figure └── unnamed-chunk-8-1.png ├── index.rst └── man ├── LAUS_AreaCodes.Rd ├── apiDF.Rd ├── blsAPI.Rd ├── blsQCEW.Rd ├── help_laus_areacodes.Rd ├── laus_get_areacode.Rd ├── laus_get_data.Rd ├── laus_get_measure.Rd └── laus_measure.Rd /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | # Folder config file 5 | Desktop.ini 6 | # Recycle Bin used on file shares 7 | $RECYCLE.BIN/ 8 | # Windows Installer files 9 | *.cab 10 | *.msi 11 | *.msm 12 | *.msp 13 | # ========================= 14 | # Operating System Files 15 | # ========================= 16 | # OSX 17 | # ========================= 18 | .DS_Store 19 | .AppleDouble 20 | .LSOverride 21 | # Icon must ends with two \r. 22 | Icon 23 | # Thumbnails 24 | ._* 25 | # Files that might appear on external disk 26 | .Spotlight-V100 27 | .Trashes 28 | .Rproj.user 29 | .Rbuildignore 30 | blsAPI.Rproj 31 | .Rhistory 32 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: blsAPI 2 | Version: 0.2.2 3 | Title: Request Data from the U.S. Bureau of Labor Statistics API 4 | Author: Michael Silva 5 | Maintainer: Michael Silva 6 | Description: Allows users to request data for one or multiple series through the 7 | U.S. Bureau of Labor Statistics API. Users provide parameters as specified in 8 | and the function returns a JSON 9 | string. 10 | Depends: 11 | R (>= 3.1.1) 12 | Imports: 13 | rjson, 14 | httr, 15 | dplyr 16 | License: GPL (>= 2) 17 | LazyData: true 18 | RoxygenNote: 7.1.1 19 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(apiDF) 4 | export(blsAPI) 5 | export(blsQCEW) 6 | export(help_laus_areacodes) 7 | export(laus_get_areacode) 8 | export(laus_get_data) 9 | export(laus_get_measure) 10 | import(dplyr) 11 | import(httr) 12 | import(rjson) 13 | importFrom(utils,read.csv) 14 | -------------------------------------------------------------------------------- /R/LAUS_AreaCodes.R: -------------------------------------------------------------------------------- 1 | #' Area codes for Labor Area Unemployment Statistics (LAUS) data 2 | #' 3 | #' A data set containing the area code and area text associated with each code for the LAUS data set 4 | #' 5 | #' @format A data frame with 8321 rows and 2 variables 6 | #' \describe{ 7 | #' \item{area_code}{area code for LAUS} 8 | #' \item{area_text}{area name for LAUS} 9 | #' } 10 | #' 11 | #' @source \url{https://download.bls.gov/pub/time.series/la/la.area} 12 | #' 13 | #' 14 | "LAUS_AreaCodes" -------------------------------------------------------------------------------- /R/apiDF.R: -------------------------------------------------------------------------------- 1 | # apiDF.R 2 | # 3 | #' @title Creates data frame after data is called using blsAPI.R 4 | #' @description Used in the laus_get_data function 5 | #' @param data The JSON used to extract the data gathered from the blsAPI function 6 | #' @return returns a data frame of the data requested from the bLSAPI function call 7 | #' @export apiDF 8 | #' @import rjson 9 | #' @examples 10 | #' library(blsAPI) 11 | #' library(rjson) 12 | #' response <- blsAPI('LAUCN040010000000005') 13 | #' json <- fromJSON(response) 14 | #' df <- apiDF(json$Results$series[[1]]$data) 15 | #' 16 | apiDF <- function(data){ 17 | df <- data.frame(year=character(), 18 | period=character(), 19 | periodName=character(), 20 | value=character(), 21 | stringsAsFactors=FALSE) 22 | 23 | i <- 0 24 | for(d in data){ 25 | i <- i + 1 26 | df[i,] <- c(d$year, d$period, d$periodName, d$value) 27 | } 28 | return(df) 29 | } -------------------------------------------------------------------------------- /R/blsAPI.R: -------------------------------------------------------------------------------- 1 | # blsAPI.R 2 | # 3 | #' @title Request Data from the U.S. Bureau Of Labor Statistics API 4 | #' @description Allows users to request data for one or multiple series through the U.S. Bureau of Labor Statistics API. Users provide parameters as specified in <\url{https://www.bls.gov/developers/api_signature.htm}> and the function returns a JSON string or data frame. 5 | #' @details See <\url{https://www.bls.gov/developers/}> and <\url{https://www.bls.gov/developers/api_signature.htm}> for more details on the payload. 6 | #' @param payload a string or a list containing data to be sent to the API. 7 | #' @param api_version an integer for which api version you want to use (i.e. 1 for v1, 2 for v2) 8 | #' @param return_data_frame a boolean if you want to the function to return JSON (default) or a data frame. If the data frame option is used, the series id will be added as a column. This is helpful if multiple series are selected. 9 | #' @keywords bls api economics 10 | #' @export blsAPI 11 | #' @import httr rjson 12 | #' @examples 13 | #' # These examples are taken from 14 | #' library(rjson) 15 | #' library(blsAPI) 16 | #' 17 | #' # API Version 1.0 R Script Sample Code 18 | #' # Single Series request 19 | #' response <- blsAPI('LAUCN040010000000005') 20 | #' json <- fromJSON(response) 21 | #' \dontrun{ 22 | #' # Multiple Series 23 | #' payload <- list('seriesid'=c('LAUCN040010000000005','LAUCN040010000000006')) 24 | #' response <- blsAPI(payload) 25 | #' json <- fromJSON(response) 26 | #' 27 | #' # One or More Series, Specifying Years 28 | #' payload <- list( 29 | #' 'seriesid' = c('LAUCN040010000000005','LAUCN040010000000006'), 30 | #' 'startyear'= 2010, 31 | #' 'endyear' = 2012) 32 | #' response <- blsAPI(payload) 33 | #' json <- fromJSON(response) 34 | #' 35 | #' # API Version 2.0 R Script Sample Code 36 | #' # Single Series 37 | #' response <- blsAPI('LAUCN040010000000005', 2) 38 | #' json <- fromJSON(response) 39 | #' # Or request a data frame 40 | #' df <- blsAPI('LAUCN040010000000005', 2, TRUE) 41 | #' 42 | #' # Multiple Series 43 | #' payload <- list('seriesid'=c('LAUCN040010000000005','LAUCN040010000000006')) 44 | #' response <- blsAPI(payload, 2) 45 | #' json <- fromJSON(response) 46 | #' 47 | #' # One or More Series with Optional Parameters 48 | #' payload <- list( 49 | #' 'seriesid'=c('LAUCN040010000000005','LAUCN040010000000006'), 50 | #' 'startyear'=2010, 51 | #' 'endyear'=2012, 52 | #' 'catalog'=FALSE, 53 | #' 'calculations'=TRUE, 54 | #' 'annualaverage'=TRUE, 55 | #' 'registrationKey'='995f4e779f204473aa565256e8afe73e') 56 | #' response <- blsAPI(payload, 2) 57 | #' json <- fromJSON(response) 58 | #' } 59 | 60 | blsAPI <- function(payload=NA, api_version=1, return_data_frame=FALSE){ 61 | if (class(payload) == "logical"){ 62 | # Payload not defined 63 | message("blsAPI: No payload specified.") 64 | } 65 | else{ 66 | # Payload specified so make the request 67 | api_url <- paste0("https://api.bls.gov/publicAPI/v", 68 | api_version, 69 | "/timeseries/data/") 70 | if (is.list(payload)){ 71 | # Multiple Series or One or More Series, Specifying Years request 72 | payload <- toJSON(payload) 73 | m <- regexpr('\\"seriesid\\":\\"[a-zA-Z0-9-]*\\",', payload) 74 | str <- regmatches(payload, m) 75 | if (length(str) > 0){ 76 | # wrap single series in [] 77 | replace <- sub(",", "],", sub(":", ":[", str)) 78 | payload <- sub(str, replace, payload) 79 | } 80 | response <- httr::POST(url = api_url, body = payload, httr::content_type_json()) 81 | } 82 | else{ 83 | # Single Series request 84 | response <- httr::GET(url = paste0(api_url, payload)) 85 | } 86 | 87 | 88 | # Return the results of the API call 89 | if (return_data_frame){ 90 | json <- fromJSON(rawToChar(response$content)) 91 | if (json$status != "REQUEST_SUCCEEDED") { 92 | stop(paste("blsAPI call failed", 93 | paste(json$message, collapse = ";"), 94 | sep=":")) 95 | } 96 | # Iterate over the series 97 | number_of_series <- length(json$Results$series) 98 | for (i in 1:number_of_series){ 99 | # Set the default structure of the data frame 100 | df_start <- data.frame(year = character(), 101 | period = character(), 102 | periodName = character(), 103 | value = character(), 104 | stringsAsFactors = FALSE) 105 | # Get the data 106 | series_data <- json$Results$series[[i]]$data 107 | # Can get no data after a successful request 108 | if (length(series_data) > 0) { 109 | j <- 0 110 | for (d in series_data) { 111 | j <- j + 1 112 | # Remove the footnotes from the list to stop the warnings 113 | d$footnotes <- NULL 114 | d$latest <- NULL 115 | # Add record to the data frame 116 | df_start[j, ] <- unlist(d) 117 | } 118 | # Add in the series id 119 | df_start$seriesID <- json$Results$series[[i]]$seriesID 120 | } 121 | # Create the data frame that will be returned 122 | if (!exists("df_to_return")){ 123 | # Data frame to return not defined so create it 124 | df_to_return <- df_start 125 | } 126 | else { 127 | # Append to the existing data frame 128 | df_to_return <- rbind(df_to_return, df_start) 129 | } 130 | } 131 | return(df_to_return) 132 | } 133 | else { 134 | # Return the JSON results 135 | return(rawToChar(response$content)) 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /R/blsQCEW.R: -------------------------------------------------------------------------------- 1 | # blsQCEW.R 2 | # 3 | #' @title Request QCEW Data from the U.S. Bureau Of Labor Statistics Open Data Access 4 | #' @description Allows users to request quarterly census of employment and wages (QCEW) data from the U.S. Bureau of Labor Statistics open access. Users provide parameters and the function returns a data frame. This function is based off of the sample code developed by the BLS that is found at <\url{https://www.bls.gov/cew/doc/access/data_access_examples.htm}>. 5 | #' @details This function is a wrapper for multiple data request methods. See code examples for which parameters are required for which methods. Visit <\url{https://www.bls.gov/cew/opendata.htm}> for an overview of the BLS's open data access. 6 | #' @param method a string describing which type of data you want requested. Valid options are: Area, Industry and Size. The method is not case sensitive. 7 | #' @param year a string for the year of data you want 8 | #' @param quarter a string indicating the quarter (1, 2, 3 or 4) or "a" for the annual average. 9 | #' @param area a string indicating which area you want the data for. See <\url{https://www.bls.gov/cew/doc/titles/area/area_titles.htm}> for all area codes and titles. 10 | #' @param industry a string for the NAICS code. Some industry codes contain hyphens but the open data access uses underscores instead of hyphens. So 31-33 becomes 31_33. For all industry codes and titles see: <\url{https://www.bls.gov/cew/doc/titles/industry/industry_titles.htm}> 11 | #' @param size a string for the size code. See <\url{https://www.bls.gov/cew/doc/titles/size/size_titles.htm}> for all establishment size classes and titles. Note: Size data is only available for the first quarter of each year. 12 | #' @keywords bls economics 13 | #' @export blsQCEW 14 | #' @importFrom utils read.csv 15 | #' @examples 16 | #' # These examples are taken from the sample code examples found at: 17 | #' # 18 | #' 19 | #' # Area Data Request 20 | #' 21 | #' # Required parameters are: 22 | #' # * year 23 | #' # * quarter 24 | #' # * area 25 | #' 26 | #' # Example: Request the first quarter of 2017 for the state of Michigan 27 | #' MichiganData <- blsQCEW('Area', year='2017', quarter='1', area='26000') 28 | #' \dontrun{ 29 | #' # Industry Data Request 30 | #' 31 | #' # Required parameters are: 32 | #' # * industry 33 | #' # * quarter 34 | #' # * year 35 | #' 36 | #' # Example: Request Construction data for the first quarter of 2017 37 | #' Construction <- blsQCEW('Industry', year='2017', quarter='1', industry='1012') 38 | #' 39 | #' # Size Data Request 40 | #' # * size 41 | #' # * year 42 | #' 43 | #' # Example: Request data for the first quarter of 2017 for establishments with 44 | #' # 100 to 249 employees 45 | #' SizeData <- blsQCEW('Size', year='2017', size='6') 46 | #' } 47 | 48 | blsQCEW <- function(method, year=NA, quarter=NA, area=NA, industry=NA, size=NA){ 49 | # This variable is changed in the case that an error has occured 50 | request_data <- TRUE 51 | # These variables are used to check that we have all needed parameters 52 | have_year <- have_quarter <- have_area <- have_industry <- have_size <- FALSE 53 | # Fix case sensitivity of the method parameter 54 | method <- tolower(method) 55 | # Get the open data url 56 | if (method == "area"){ 57 | url <- "https://data.bls.gov/cew/data/api/YEAR/QTR/area/AREA.csv" 58 | } else if (method == "industry"){ 59 | url <- "https://data.bls.gov/cew/data/api/YEAR/QTR/industry/INDUSTRY.csv" 60 | } else if (method == "size"){ 61 | url <- "https://data.bls.gov/cew/data/api/YEAR/1/size/SIZE.csv" 62 | } else { 63 | message('blsQCEW: Method not valid. Please use "Area", "Industry" or "Size".') 64 | request_data <- FALSE 65 | } 66 | # Update the URL with the parameters 67 | if (class(year) != "logical"){ 68 | have_year <- TRUE 69 | url <- sub("YEAR", year, url, ignore.case = FALSE) 70 | } 71 | if (class(quarter) != "logical"){ 72 | have_quarter <- TRUE 73 | url <- sub("QTR", quarter, url, ignore.case = FALSE) 74 | } 75 | if (class(area) != "logical"){ 76 | have_area <- TRUE 77 | url <- sub("AREA", area, url, ignore.case = FALSE) 78 | } 79 | if (class(industry) != "logical"){ 80 | have_industry <- TRUE 81 | url <- sub("INDUSTRY", industry, url, ignore.case = FALSE) 82 | } 83 | if (class(size) != "logical"){ 84 | have_size <- TRUE 85 | url <- sub("SIZE", size, url, ignore.case=FALSE) 86 | } 87 | # Check to make sure we have all the parameters we need 88 | if (method == "area" && (!have_area || !have_year || !have_quarter)){ 89 | request_data <- FALSE 90 | message('blsQCEW: Missing parameter for area request. The area, year and quarter parameters are needed.') 91 | } else if (method == "industry" && (!have_industry || !have_year || !have_quarter)){ 92 | request_data <- FALSE 93 | message('blsQCEW: Missing parameter for industry request. The industry, year and quarter parameters are needed.') 94 | } else if (method == "size" && (!have_size || !have_year)){ 95 | request_data <- FALSE 96 | message('blsQCEW: Missing parameter for size request. The size and year parameters are needed.') 97 | } 98 | if (request_data){ 99 | # Return the data frame 100 | read.csv(url, header <- TRUE, sep <- ",", quote="\"", dec=".", 101 | na.strings=" ", skip=0) 102 | } 103 | } -------------------------------------------------------------------------------- /R/help_laus_areacodes.R: -------------------------------------------------------------------------------- 1 | # help_laus_areacodes 2 | 3 | #' @title Prints a list of area names associated to an area code for the LAUS data 4 | #' @return prints a list in the console 5 | #' @export help_laus_areacodes 6 | #' 7 | #' @examples 8 | #' library(blsAPI) 9 | #' library(dplyr) 10 | #' help_laus_areacodes() 11 | #' 12 | help_laus_areacodes <- function(){ 13 | data("LAUS_AreaCodes", envir = environment()) 14 | AreaName <- select(LAUS_AreaCodes, "area_text") 15 | print.data.frame(AreaName) 16 | } 17 | -------------------------------------------------------------------------------- /R/laus_get_areacode.R: -------------------------------------------------------------------------------- 1 | # laus_get_areacode 2 | # 3 | #' @title Acquire the area code used in the series id for observations in Labor Area Unemployment Statistics (LAUS) data 4 | #' @description Gathers the area code used in the laus_get_data function to acquire a data frame using the blsAPI function that request data through the U.S. Bureau of Labor Statistics API. The laus_get_areacode function is called by the laus_get_data function not the user. 5 | #' @param Location_Name A string or vector of the different cities, states or metropolitan statistical areas you want LAUS data from 6 | #' @details type help_laus_areacodes() to get a list of all of the area names that area associated to an area code in the LAUS data 7 | #' @export laus_get_areacode 8 | #' @return returns a string or vector representing area codes 9 | #' @examples 10 | #' library(blsAPI) 11 | #' laus_get_areacode(Location_Name = c("Florida", "California", 12 | #' "Charlotte County, FL", "Fresno County, CA")) 13 | #' 14 | laus_get_areacode <- function(Location_Name){ 15 | # Loading in the Area Code rda file 16 | data("LAUS_AreaCodes", envir = environment()) 17 | # 18 | laus_df <- subset(LAUS_AreaCodes, LAUS_AreaCodes$area_text %in% Location_Name, select = c("area_code", 'area_text')) 19 | # 20 | laus_vector <- laus_df$area_code 21 | return(laus_vector) 22 | } -------------------------------------------------------------------------------- /R/laus_get_data.R: -------------------------------------------------------------------------------- 1 | # laus_get_data.R 2 | # 3 | #' @title A wrapper function for blsAPI.R function that processes gathered Labor Area Unemployment Statistics (LAUS) data into a data frame 4 | #' @description Allows users to request LAUS data and have it downloaded as a data frame with ease 5 | #' @param location.vector A string or vector of the different cities, states or metropolitan statistical areas you want LAUS data from. To get help type help_laus_areacodes() to get a list of all of the area names that area associated to an area code in the LAUS data 6 | #' @param measure.vector A string of the laus measure you want to gather in your call, e.g. unemployment, unemployment rate. 7 | #' @param start.year The year you want as the beginning period of data collection 8 | #' @param end.year The year you want as the ending period of data collection 9 | #' @param api.version A numerical value that specifies which version of the api you're using (1 or 2). Default is version 1. 10 | #' @param bls.key The BLS key you're using to retrieve data using version 2 11 | #' @export laus_get_data 12 | #' @import dplyr rjson 13 | #' @examples 14 | #' library(blsAPI) 15 | #' library(dplyr) 16 | #' library(rjson) 17 | #' unem_df <- laus_get_data(location.vector = c("Florida", "California", 18 | #' "Charlotte County, FL", "Fresno County, CA"), 19 | #' measure.vector = "unemployment rate", 20 | #' start.year = 2019, end.year = 2021, 21 | #' api.version = 1) 22 | #' 23 | laus_get_data <- function(location.vector, measure.vector, start.year, end.year, api.version=1, bls.key=NULL){ 24 | 25 | # Saves the Fips codes to a vector for later use 26 | SeriesID <- laus_get_areacode(location.vector) 27 | 28 | # Saves the measure code to a vector for later use 29 | Measure_Code <- laus_get_measure(measure = measure.vector) 30 | 31 | # Initializes a blank character vector that will house the Series IDs for the LAUS data for each location and for one specified measure 32 | location_vec <- character() 33 | # For loop that creates a Series ID for each location based on the measure selected 34 | for (i in SeriesID){ 35 | location_vec <- c(location_vec, paste("LAU",i, Measure_Code, sep="")) 36 | } 37 | 38 | # An if statement to ascertain which version of the API is used then creates the correct payload 39 | if (api.version==1){ 40 | payload <- list( 41 | 'seriesid'=c(location_vec), 42 | 'startyear'=start.year, 43 | 'endyear'=end.year) 44 | response <- blsAPI(payload, api_version = api.version) 45 | json <- fromJSON(response) 46 | return 47 | }else if(api.version==2){ 48 | payload <- list( 49 | 'seriesid'=c(location_vec), 50 | 'startyear'=start.year, 51 | 'endyear'=end.year, 52 | 'registrationKey'=bls.key) 53 | response <- blsAPI(payload, api_version = api.version) 54 | json <- fromJSON(response) 55 | } 56 | 57 | # Creates an empty data frame with specified columns 58 | # Used later in the next for loop to house data for each area 59 | df = data.frame( 60 | year = character(), 61 | period = character(), 62 | periodName = character(), 63 | value = numeric(), 64 | Location = character() 65 | ) 66 | 67 | # 68 | n = 1 69 | # For loop that takes the data for each area and adds its rows to the df specified above 70 | for (i in location.vector){ 71 | temp <- apiDF(json$Results$series[[n]]$data) 72 | temp$Location <- i 73 | temp$value <- as.numeric(temp$value) 74 | df <- rbind(df, temp) 75 | n = n +1 76 | } 77 | 78 | # If else statements to rename the value column based on the measure used 79 | if(Measure_Code == "03"){ 80 | df <- dplyr::rename(df, Unemployment_Rate = value) 81 | }else if(Measure_Code == "04"){ 82 | df <- dplyr::rename(df, Unemployment = value) 83 | }else if(Measure_Code == "05"){ 84 | df <- dplyr::rename(df, Employment = value) 85 | }else if(Measure_Code == "06"){ 86 | df <- dplyr::rename(df, Labor_Force = value) 87 | }else if(Measure_Code == "07"){ 88 | df <- dplyr::rename(df, Employment_Pop_Ratio = value) 89 | }else if(Measure_Code == "08"){ 90 | df <- dplyr::rename(df, Labor_Force_Participation_Rate = value) 91 | }else if(Measure_Code == "09"){ 92 | df <- dplyr::rename(df, Civilian = value) 93 | } 94 | 95 | return(df) 96 | } -------------------------------------------------------------------------------- /R/laus_get_measure.R: -------------------------------------------------------------------------------- 1 | # laus_get_measure.R 2 | # 3 | #' @title Acquire the measure code used in the series id for observations in Labor Area Unemployment Statistics (LAUS) data 4 | #' @description Gathers the measure code used in the laus_get_data function to acquire a data frame using the blsAPI function that request data through the U.S. Bureau of Labor Statistics API. The laus_get_areacode function is called by the laus_get_data function not the user. 5 | #' @param measure a string containing the desired measure. Exs: unemployment rate, labor force, employment, etc. 6 | #' @details See <\url{https://download.bls.gov/pub/time.series/la/la.measure}> to see the format of the strings used in the measure param found in the measure_text column 7 | #' @return returns a string representing a measure code 8 | #' @export laus_get_measure 9 | #' @ 10 | #' @examples 11 | #' library(blsAPI) 12 | #' laus_get_measure("unemployment rate") 13 | laus_get_measure <- function(measure){ 14 | # 15 | data("laus_measure", envir = environment()) 16 | # 17 | laus_df <- subset(laus_measure, laus_measure$measure_text %in% measure, select = c("measure_code", 'measure_text')) 18 | # 19 | laus_vector <- laus_df$measure_code 20 | return(laus_vector) 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R/laus_measure.R: -------------------------------------------------------------------------------- 1 | #' Measure codes for Labor Area Unemployment Statistics (LAUS) data 2 | #' 3 | #' A data set containing the measure code and measure text associated with each code for the LAUS data set 4 | #' 5 | #' @format A data frame with 7 rows and 2 variables 6 | #' \describe{ 7 | #' \item{measure_code}{measure code for LAUS} 8 | #' \item{measure_text}{measure name for LAUS} 9 | #' } 10 | #' 11 | #' @source \url{https://download.bls.gov/pub/time.series/la/la.measure} 12 | #' 13 | #' 14 | "laus_measure" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # blsAPI — U.S. Bureau of Labor Statistics Data for R 2 | 3 | 4 | blsAPI is an R package that allows users to request data for one or multiple series through the U.S. Bureau of Labor Statistics (BLS) Application Programming Interface (API). The BLS API gives the public access to economic data from all BLS programs. 5 | 6 | ## Quick Tour 7 | 8 | ### Installation 9 | blsAPI can be installed easily through [CRAN](https://cran.r-project.org/package=blsAPI) or [GitHub](https://github.com/mikeasilva/blsAPI). 10 | 11 | #### CRAN 12 | 13 | ```r 14 | install.packages('blsAPI') 15 | ``` 16 | 17 | #### GitHub 18 | 19 | ```r 20 | library(devtools) 21 | install_github('mikeasilva/blsAPI') 22 | ``` 23 | 24 | ### API Basics 25 | The blsAPI package supports two versions of the BLS API. API Version 2.0 requires registration and offers greater query limits. It also allows users to request net and percent changes and series description information. See below for more details. 26 | 27 | | Service | Version 2.0 (Registered) | Version 1.0 (Unregistered) | 28 | |:-----------------------------------------|:--------------------------:|:----------------------------:| 29 | | Daily query limit | 500 | 25 | 30 | | Series per query limit | 50 | 25 | 31 | | Years per query limit | 20 | 10 | 32 | | Net/Percent Changes | Yes | No | 33 | | Optional annual averages | Yes | No | 34 | | Series description information (catalog) | Yes | No | 35 | 36 | ### Sample Code 37 | 38 | #### Example 1 39 | The following example will retrieve the civilian unadjusted Employment Cost Index (ECI) via the API and process the request into a data frame. 40 | 41 | 42 | ```r 43 | library(rjson) 44 | library(blsAPI) 45 | 46 | response <- blsAPI('CIU1010000000000A') 47 | json <- fromJSON(response) 48 | 49 | data_list <- json$Results$series[[1]]$data[-1] 50 | cpi <- data.frame(matrix(unlist(data_list), ncol = 4, byrow = TRUE, 51 | dimnames = list(NULL, c("year", "period", 52 | "periodName", "value"))), 53 | stringsAsFactors = FALSE) 54 | cpi 55 | 56 | ``` 57 | 58 | The resulting data frame looks like this (Note: Your results may look different depending on when you pull the data): 59 | 60 | 61 | | year | period | periodName | value | 62 | |:------:|:--------:|:------------:|:-------:| 63 | | 2014 | Q03 | 3rd Quarter | 2.2 | 64 | | 2014 | Q02 | 2nd Quarter | 2.0 | 65 | | 2014 | Q01 | 1st Quarter | 1.8 | 66 | | 2013 | Q04 | 4th Quarter | 2.0 | 67 | | 2013 | Q03 | 3rd Quarter | 1.9 | 68 | | 2013 | Q02 | 2nd Quarter | 1.9 | 69 | | 2013 | Q01 | 1st Quarter | 1.9 | 70 | | 2012 | Q04 | 4th Quarter | 1.9 | 71 | | 2012 | Q03 | 3rd Quarter | 1.9 | 72 | | 2012 | Q02 | 2nd Quarter | 1.7 | 73 | | 2012 | Q01 | 1st Quarter | 1.9 | 74 | 75 | #### Example 2 76 | This example pulls monthly unemployment and labor force estimates for Manhattan (New York County, NY) using the version 2.0 API. We graph a calculated unemployment rate including shading for the Great Recession. According the [National Bureau of Economic Research (NBER)](http://www.nber.org/cycles.html) the Great Recession ran from December 2007 to June 2009. 77 | 78 | 79 | ```r 80 | library(rjson) 81 | library(blsAPI) 82 | library(ggplot2) 83 | 84 | ## Pull the data via the API 85 | payload <- list( 86 | 'seriesid' = c('LAUCN360610000000004', 'LAUCN360610000000006'), 87 | 'startyear' = 2007, 88 | 'endyear' = 2009) 89 | response <- blsAPI(payload, 2) 90 | json <- fromJSON(response) 91 | 92 | ## Process results 93 | apiDF <- function(data) { 94 | df <- data.frame(matrix(unlist(data), nrow = length(data), byrow = TRUE)) 95 | colnames(df) <- c("year", "period", "periodName", "value") 96 | return(df) 97 | } 98 | 99 | 100 | unemployed.df <- apiDF(json$Results$series[[1]]$data) 101 | labor.force.df <- apiDF(json$Results$series[[2]]$data) 102 | 103 | ## Change value type from character to numeric 104 | unemployed.df[,4] <- as.numeric(unemployed.df[,4]) 105 | labor.force.df[,4] <- as.numeric(labor.force.df[,4]) 106 | 107 | ## Rename value prior to merging 108 | names(unemployed.df)[4] <- 'unemployed' 109 | names(labor.force.df)[4] <- 'labor.force' 110 | 111 | ## Merge data frames 112 | df <- merge(unemployed.df, labor.force.df) 113 | 114 | ## Create date and unemployement rate 115 | df$unemployment.rate <- df$unemployed / df$labor.force 116 | df$date <- as.POSIXct(strptime(paste0('1',df$periodName,df$year), '%d%B%Y')) 117 | 118 | ## Beginning and end dates for the Great Recession (used in shaded area) 119 | gr.start <- as.POSIXct(strptime('1December2007', '%d%B%Y')) 120 | gr.end <- as.POSIXct(strptime('1June2009', '%d%B%Y')) 121 | 122 | ## Plot the data 123 | ggplot(df) + geom_rect(aes(xmin = gr.start, xmax = gr.end, ymin = -Inf, ymax = Inf), alpha = 0.4, fill="#DDDDDD") + geom_line(aes(date, unemployment.rate*100)) + ylab('Percent of labor force') + xlab('Great Recession shaded in gray') + ggtitle('Unemployment Rate for Manhattan, NY (Jan 2007 to Dec 2010)') + theme_bw() 124 | ``` 125 | 126 | ![](https://github.com/mikeasilva/blsAPI/blob/master/figure/unnamed-chunk-8-1.png) 127 | 128 | ## Quarterly Census of Employment and Wages (QCEW) Open Data 129 | The BLS has made QCEW data available through an open data access option. This package can access this data. 130 | 131 | ```r 132 | ## Request the first quarter of 2017 for the state of Michigan 133 | MichiganData <- blsQCEW('Area', year='2017', quarter='1', area='26000') 134 | ``` 135 | 136 | Please see the help file for more options and example code. 137 | 138 | ## Labor Area Unemployment Statistics Function 139 | The laus_get_data() function is a wrapper of the blsAPI() function that makes it easier to get the labor area unemployment data without knowing the Series ID for the specific area and measure you want. A few examples of a measure would be the unemployment rate, or the labor force. 140 | 141 | #### Example 142 | This example pulls the unemployment rate for California, Florida, Texas, and Nevada from 2019 to 2021. 143 | 144 | ```r 145 | library(rjson) 146 | library(blsAPI) 147 | library(dplyr) 148 | 149 | unemployment_rate <- laus_get_data(c("California", "Florida", "Texas", "Nevada"), "unemployment rate", 2019, 2021) 150 | ``` 151 | 152 | The resulting data frame will look like this for the first four rows 153 | | year | period | periodName | Unemployment_Rate | Location | 154 | |:------:|:--------:|:------------:|:-------------------:|:----------:| 155 | | 2021 | M07 | July | 2.2 | California | 156 | | 2021 | M06 | June | 2.0 | California | 157 | | 2021 | M05 | May | 1.8 | California | 158 | | 2021 | M04 | April | 2.0 | California | 159 | 160 | For more examples of this function and to learn more about it type ?laus_get_data in your R console. 161 | 162 | ## Learning More 163 | With the basics described above you can get started with the BLS API right away. To learn more see: 164 | 165 | * [BLS API Home](http://www.bls.gov/developers/) 166 | * [BLS API FAQ](http://www.bls.gov/developers/api_faqs.htm) 167 | * [BLS Help & Tutorials: Series ID Formats](http://www.bls.gov/help/hlpforma.htm) 168 | * [Register for BLS API v 2.0](http://data.bls.gov/registrationEngine/) 169 | -------------------------------------------------------------------------------- /data/LAUS_AreaCodes.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikeasilva/blsAPI/a125b3a7b8773477443636693623b5e79d20ea5d/data/LAUS_AreaCodes.RData -------------------------------------------------------------------------------- /data/laus_measure.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikeasilva/blsAPI/a125b3a7b8773477443636693623b5e79d20ea5d/data/laus_measure.RData -------------------------------------------------------------------------------- /figure/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikeasilva/blsAPI/a125b3a7b8773477443636693623b5e79d20ea5d/figure/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /index.rst: -------------------------------------------------------------------------------- 1 | ======== 2 | blsAPI 3 | ======== 4 | Request Data from the U.S. Bureau of Labor Statistics API 5 | 6 | Introduction 7 | ============ 8 | blsAPI is an R package that allows users to request data for one or multiple series through the U.S. Bureau of Labor Statistics API. Users provide parameters as specified in http://www.bls.gov/developers/api_signature.htm and the function returns a JSON string or data frame. 9 | 10 | Installation 11 | ============ 12 | blsAPI can be installed easily through `CRAN `_ 13 | or `GitHub 14 | `_ Select which repository you would like to use and type the following commands in R: 15 | 16 | CRAN 17 | ---- 18 | ``install.packages('blsAPI')`` 19 | 20 | GitHub 21 | ------ 22 | ``library(devtools); install_github('mikeasilva/blsAPI')`` 23 | 24 | API Basics 25 | ========== 26 | The blsAPI package supports two versions of the BLS API. API Version 2.0 requires registration and offers greater query limits. It also allows users to request net and percent changes and series description information. See below for more details. 27 | 28 | ======================================== ======================== ========================== 29 | Service Version 2.0 (Registered) Version 1.0 (Unregistered) 30 | ======================================== ======================== ========================== 31 | Daily query limit 500 25 32 | Series per query limit 50 25 33 | Years per query limit 20 10 34 | Net/Percent Changes Yes No 35 | Optional annual averages Yes No 36 | Series description information (catalog) Yes No 37 | ======================================== ======================== ========================== 38 | 39 | -------------------------------------------------------------------------------- /man/LAUS_AreaCodes.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/LAUS_AreaCodes.R 3 | \docType{data} 4 | \name{LAUS_AreaCodes} 5 | \alias{LAUS_AreaCodes} 6 | \title{Area codes for Labor Area Unemployment Statistics (LAUS) data} 7 | \format{ 8 | A data frame with 8321 rows and 2 variables 9 | \describe{ 10 | \item{area_code}{area code for LAUS} 11 | \item{area_text}{area name for LAUS} 12 | } 13 | } 14 | \source{ 15 | \url{https://download.bls.gov/pub/time.series/la/la.area} 16 | } 17 | \usage{ 18 | LAUS_AreaCodes 19 | } 20 | \description{ 21 | A data set containing the area code and area text associated with each code for the LAUS data set 22 | } 23 | \keyword{datasets} 24 | -------------------------------------------------------------------------------- /man/apiDF.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/apiDF.R 3 | \name{apiDF} 4 | \alias{apiDF} 5 | \title{Creates data frame after data is called using blsAPI.R} 6 | \usage{ 7 | apiDF(data) 8 | } 9 | \arguments{ 10 | \item{data}{The JSON used to extract the data gathered from the blsAPI function} 11 | } 12 | \value{ 13 | returns a data frame of the data requested from the bLSAPI function call 14 | } 15 | \description{ 16 | Used in the laus_get_data function 17 | } 18 | \examples{ 19 | library(blsAPI) 20 | library(rjson) 21 | response <- blsAPI('LAUCN040010000000005') 22 | json <- fromJSON(response) 23 | df <- apiDF(json$Results$series[[1]]$data) 24 | 25 | } 26 | -------------------------------------------------------------------------------- /man/blsAPI.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/blsAPI.R 3 | \name{blsAPI} 4 | \alias{blsAPI} 5 | \title{Request Data from the U.S. Bureau Of Labor Statistics API} 6 | \usage{ 7 | blsAPI(payload = NA, api_version = 1, return_data_frame = FALSE) 8 | } 9 | \arguments{ 10 | \item{payload}{a string or a list containing data to be sent to the API.} 11 | 12 | \item{api_version}{an integer for which api version you want to use (i.e. 1 for v1, 2 for v2)} 13 | 14 | \item{return_data_frame}{a boolean if you want to the function to return JSON (default) or a data frame. If the data frame option is used, the series id will be added as a column. This is helpful if multiple series are selected.} 15 | } 16 | \description{ 17 | Allows users to request data for one or multiple series through the U.S. Bureau of Labor Statistics API. Users provide parameters as specified in <\url{https://www.bls.gov/developers/api_signature.htm}> and the function returns a JSON string or data frame. 18 | } 19 | \details{ 20 | See <\url{https://www.bls.gov/developers/}> and <\url{https://www.bls.gov/developers/api_signature.htm}> for more details on the payload. 21 | } 22 | \examples{ 23 | # These examples are taken from 24 | library(rjson) 25 | library(blsAPI) 26 | 27 | # API Version 1.0 R Script Sample Code 28 | # Single Series request 29 | response <- blsAPI('LAUCN040010000000005') 30 | json <- fromJSON(response) 31 | \dontrun{ 32 | # Multiple Series 33 | payload <- list('seriesid'=c('LAUCN040010000000005','LAUCN040010000000006')) 34 | response <- blsAPI(payload) 35 | json <- fromJSON(response) 36 | 37 | # One or More Series, Specifying Years 38 | payload <- list( 39 | 'seriesid'=c('LAUCN040010000000005','LAUCN040010000000006'), 40 | 'startyear'=2010, 41 | 'endyear'=2012) 42 | response <- blsAPI(payload) 43 | json <- fromJSON(response) 44 | 45 | # API Version 2.0 R Script Sample Code 46 | # Single Series 47 | response <- blsAPI('LAUCN040010000000005', 2) 48 | json <- fromJSON(response) 49 | # Or request a data frame 50 | df <- blsAPI('LAUCN040010000000005', 2, TRUE) 51 | 52 | # Multiple Series 53 | payload <- list('seriesid'=c('LAUCN040010000000005','LAUCN040010000000006')) 54 | response <- blsAPI(payload, 2) 55 | json <- fromJSON(response) 56 | 57 | # One or More Series with Optional Parameters 58 | payload <- list( 59 | 'seriesid'=c('LAUCN040010000000005','LAUCN040010000000006'), 60 | 'startyear'=2010, 61 | 'endyear'=2012, 62 | 'catalog'=FALSE, 63 | 'calculations'=TRUE, 64 | 'annualaverage'=TRUE, 65 | 'registrationKey'='995f4e779f204473aa565256e8afe73e') 66 | response <- blsAPI(payload, 2) 67 | json <- fromJSON(response) 68 | } 69 | } 70 | \keyword{api} 71 | \keyword{bls} 72 | \keyword{economics} 73 | -------------------------------------------------------------------------------- /man/blsQCEW.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/blsQCEW.R 3 | \name{blsQCEW} 4 | \alias{blsQCEW} 5 | \title{Request QCEW Data from the U.S. Bureau Of Labor Statistics Open Data Access} 6 | \usage{ 7 | blsQCEW(method, year = NA, quarter = NA, area = NA, industry = NA, 8 | size = NA) 9 | } 10 | \arguments{ 11 | \item{method}{a string describing which type of data you want requested. Valid options are: Area, Industry and Size. The method is not case sensitive.} 12 | 13 | \item{year}{a string for the year of data you want} 14 | 15 | \item{quarter}{a string indicating the quarter (1, 2, 3 or 4) or "a" for the annual average.} 16 | 17 | \item{area}{a string indicating which area you want the data for. See <\url{https://www.bls.gov/cew/doc/titles/area/area_titles.htm}> for all area codes and titles.} 18 | 19 | \item{industry}{a string for the NAICS code. Some industry codes contain hyphens but the open data access uses underscores instead of hyphens. So 31-33 becomes 31_33. For all industry codes and titles see: <\url{https://www.bls.gov/cew/doc/titles/industry/industry_titles.htm}>} 20 | 21 | \item{size}{a string for the size code. See <\url{https://www.bls.gov/cew/doc/titles/size/size_titles.htm}> for all establishment size classes and titles. Note: Size data is only available for the first quarter of each year.} 22 | } 23 | \description{ 24 | Allows users to request quarterly census of employment and wages (QCEW) data from the U.S. Bureau of Labor Statistics open access. Users provide parameters and the function returns a data frame. This function is based off of the sample code developed by the BLS that is found at <\url{https://www.bls.gov/cew/doc/access/data_access_examples.htm}>. 25 | } 26 | \details{ 27 | This function is a wrapper for multiple data request methods. See code examples for which parameters are required for which methods. Visit <\url{https://www.bls.gov/cew/opendata.htm}> for an overview of the BLS's open data access. 28 | } 29 | \examples{ 30 | # These examples are taken from the sample code examples found at: 31 | # 32 | 33 | # Area Data Request 34 | 35 | # Required parameters are: 36 | # * year 37 | # * quarter 38 | # * area 39 | 40 | # Example: Request the first quarter of 2017 for the state of Michigan 41 | MichiganData <- blsQCEW('Area', year='2017', quarter='1', area='26000') 42 | \dontrun{ 43 | # Industry Data Request 44 | 45 | # Required parameters are: 46 | # * industry 47 | # * quarter 48 | # * year 49 | 50 | # Example: Request Construction data for the first quarter of 2017 51 | Construction <- blsQCEW('Industry', year='2017', quarter='1', industry='1012') 52 | 53 | # Size Data Request 54 | # * size 55 | # * year 56 | 57 | # Example: Request data for the first quarter of 2017 for establishments with 58 | # 100 to 249 employees 59 | SizeData <- blsQCEW('Size', year='2017', size='6') 60 | } 61 | } 62 | \keyword{bls} 63 | \keyword{economics} 64 | -------------------------------------------------------------------------------- /man/help_laus_areacodes.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/help_laus_areacodes.R 3 | \name{help_laus_areacodes} 4 | \alias{help_laus_areacodes} 5 | \title{Prints a list of area names associated to an area code for the LAUS data} 6 | \usage{ 7 | help_laus_areacodes() 8 | } 9 | \value{ 10 | prints a list in the console 11 | } 12 | \description{ 13 | Prints a list of area names associated to an area code for the LAUS data 14 | } 15 | \examples{ 16 | library(blsAPI) 17 | library(dplyr) 18 | help_laus_areacodes() 19 | 20 | } 21 | -------------------------------------------------------------------------------- /man/laus_get_areacode.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/laus_get_areacode.R 3 | \name{laus_get_areacode} 4 | \alias{laus_get_areacode} 5 | \title{Acquire the area code used in the series id for observations in Labor Area Unemployment Statistics (LAUS) data} 6 | \usage{ 7 | laus_get_areacode(Location_Name) 8 | } 9 | \arguments{ 10 | \item{Location_Name}{A string or vector of the different cities, states or metropolitan statistical areas you want LAUS data from} 11 | } 12 | \value{ 13 | returns a string or vector representing area codes 14 | } 15 | \description{ 16 | Gathers the area code used in the laus_get_data function to acquire a data frame using the blsAPI function that request data through the U.S. Bureau of Labor Statistics API. The laus_get_areacode function is called by the laus_get_data function not the user. 17 | } 18 | \details{ 19 | type help_laus_areacodes() to get a list of all of the area names that area associated to an area code in the LAUS data 20 | } 21 | \examples{ 22 | library(blsAPI) 23 | laus_get_areacode(Location_Name = c("Florida", "California", 24 | "Charlotte County, FL", "Fresno County, CA")) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /man/laus_get_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/laus_get_data.R 3 | \name{laus_get_data} 4 | \alias{laus_get_data} 5 | \title{A wrapper function for blsAPI.R function that processes gathered Labor Area Unemployment Statistics (LAUS) data into a data frame} 6 | \usage{ 7 | laus_get_data( 8 | location.vector, 9 | measure.vector, 10 | start.year, 11 | end.year, 12 | api.version = 1, 13 | bls.key = NULL 14 | ) 15 | } 16 | \arguments{ 17 | \item{location.vector}{A string or vector of the different cities, states or metropolitan statistical areas you want LAUS data from. To get help type help_laus_areacodes() to get a list of all of the area names that area associated to an area code in the LAUS data} 18 | 19 | \item{measure.vector}{A string of the laus measure you want to gather in your call, e.g. unemployment, unemployment rate.} 20 | 21 | \item{start.year}{The year you want as the beginning period of data collection} 22 | 23 | \item{end.year}{The year you want as the ending period of data collection} 24 | 25 | \item{api.version}{A numerical value that specifies which version of the api you're using (1 or 2). Default is version 1.} 26 | 27 | \item{bls.key}{The BLS key you're using to retrieve data using version 2} 28 | } 29 | \description{ 30 | Allows users to request LAUS data and have it downloaded as a data frame with ease 31 | } 32 | \examples{ 33 | library(blsAPI) 34 | library(dplyr) 35 | library(rjson) 36 | unem_df <- laus_get_data(location.vector = c("Florida", "California", 37 | "Charlotte County, FL", "Fresno County, CA"), 38 | measure.vector = "unemployment rate", 39 | start.year = 2019, end.year = 2021, 40 | api.version = 1) 41 | 42 | } 43 | -------------------------------------------------------------------------------- /man/laus_get_measure.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/laus_get_measure.R 3 | \name{laus_get_measure} 4 | \alias{laus_get_measure} 5 | \title{Acquire the measure code used in the series id for observations in Labor Area Unemployment Statistics (LAUS) data} 6 | \usage{ 7 | laus_get_measure(measure) 8 | } 9 | \arguments{ 10 | \item{measure}{a string containing the desired measure. Exs: unemployment rate, labor force, employment, etc.} 11 | } 12 | \value{ 13 | returns a string representing a measure code 14 | } 15 | \description{ 16 | Gathers the measure code used in the laus_get_data function to acquire a data frame using the blsAPI function that request data through the U.S. Bureau of Labor Statistics API. The laus_get_areacode function is called by the laus_get_data function not the user. 17 | } 18 | \details{ 19 | See <\url{https://download.bls.gov/pub/time.series/la/la.measure}> to see the format of the strings used in the measure param found in the measure_text column 20 | } 21 | \examples{ 22 | library(blsAPI) 23 | laus_get_measure("unemployment rate") 24 | } 25 | -------------------------------------------------------------------------------- /man/laus_measure.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/laus_measure.R 3 | \docType{data} 4 | \name{laus_measure} 5 | \alias{laus_measure} 6 | \title{Measure codes for Labor Area Unemployment Statistics (LAUS) data} 7 | \format{ 8 | A data frame with 7 rows and 2 variables 9 | \describe{ 10 | \item{measure_code}{measure code for LAUS} 11 | \item{measure_text}{measure name for LAUS} 12 | } 13 | } 14 | \source{ 15 | \url{https://download.bls.gov/pub/time.series/la/la.measure} 16 | } 17 | \usage{ 18 | laus_measure 19 | } 20 | \description{ 21 | A data set containing the measure code and measure text associated with each code for the LAUS data set 22 | } 23 | \keyword{datasets} 24 | --------------------------------------------------------------------------------