Skip to contents

Gets an ACS census topic object (report group) for the given years of the Demographic and Economic Areas that are downloaded and unzipped, available to be queried.

Usage

as_acs_5yr_topic(ac, area, years, topic)

# S3 method for acs_5yr
as_acs_5yr_topic(ac, area, years = NULL, topic = NULL)

Arguments

ac

An acs_5yr object.

area

A string, area name.

years

A vector, year number.

topic

A vector, topic name.

Value

An acs_5yr_topic object.

Details

If no year is indicated, all available years are taken. If no topic is given, the first one that appears in the files is taken.

Examples


# \donttest{
dir <- tempdir()
source_dir <- system.file("extdata/acs_5yr", package = "geogenr")
files <- list.files(source_dir, "*.zip", full.names = TRUE)
file.copy(from = files, to = dir, overwrite = TRUE)
#> [1] TRUE TRUE
ac <- acs_5yr(dir)

files <- ac |>
  unzip_files()

anrc_2021_x01 <- ac |>
  as_acs_5yr_topic("Alaska Native Regional Corporation",
                   2021,
                   "X01 Age And Sex")

anrc_2021_2022_x01_x07 <- ac |>
  as_acs_5yr_topic("Alaska Native Regional Corporation",
                   topic = c("X01 Age And Sex", "X07 Migration"))
# }