Skip to contents

Download American Community Survey population data from the U.S. Census Bureau.

Usage

dcf_load_census(
  year = 2021,
  out_dir = NULL,
  state_only = FALSE,
  overwrite = FALSE,
  verbose = TRUE
)

Arguments

year

Data year.

out_dir

Directory to download the file to.

state_only

Logical; if TRUE, will only load state data. Will still download county data.

overwrite

Logical; if TRUE, will re-download and overwrite existing data.

verbose

Logical; if FALSE, will not display status messages.

Value

A data.frame including GEOID and region_name for states and counties, along with their population, in total and within age brackets.

Examples

if (file.exists("../../resources/census_population_2021.csv.xz")) {
  dcf_load_census(2021, "../../resources")[1:10, ]
}