Fetches CPS (Current Population Survey) data across all states from the Census API.

get_cps_data_all_states(
  year_range,
  variable_list,
  state_filter = FALSE,
  census_api_key = get_key()
)

Arguments

year_range

A vector of years for which data is to be fetched.

variable_list

A list of variables to be included in the fetched data.

state_filter

A character vector specifying which states' data should be retrieved. If set to FALSE (default), data for all states will be fetched.

census_api_key

A character string representing the user's API key for accessing the Census API. By default, it retrieves the API key set as the "CENSUS_API_KEY" environment variable.

Value

A data frame containing the fetched CPS data.

Examples

if (FALSE) {
get_cps_data_all_states(c(2022, 2023), c("PESEX", "PRTAGE"), state_filter = "32")
}