This function retrieves the labels for a given CPS basic variable for the specified year(s). It constructs a list of labels fetched from the Census API for the given variable(s) and year(s).

get_labels(var_name, year_range = "2023")

Arguments

var_name

A character vector of variable name(s) to get labels for.

year_range

A character vector specifying the year(s) for which labels are required, default is "2023".

Value

If a single year and variable are provided, the function returns a data frame. For multiple years or variables, it returns a nested list of data frames.

Examples

if (FALSE) {
  labels <- get_labels("PEMLR")
  print(labels)

  labels_mult_years <- get_labels("PERRP", year_range = c(2019:2020))
  print(labels_mult_years)
}