This function fetches CPS data for a specific state from the Census API.

get_cps_data_state(
  year_range,
  variable_list,
  census_api_key = get_key(),
  state_code = "32"
)

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.

census_api_key

Your Census API key. Defaults to the key stored in the system environment "CENSUS_API_KEY".

state_code

A character string specifying the state FIPS code for which data should be fetched. Default is "32", which is the FIPS code for Nevada. Only accepts one state code at a time.

Value

A data frame containing the fetched CPS data for the specified state.

Examples

if (FALSE) {
get_cps_data_state(c(2022, 2023), c("PESEX", "PRTAGE"))
}