Skip to contents

Download and clean up US States,DC,PR block data Census 2020 (for EJAM)

Usage

census2020_get_data(
  folder = NULL,
  folderout = NULL,
  mystates = c(state.abb, "DC", "PR"),
  do_download = TRUE,
  do_unzip = TRUE,
  do_read = TRUE,
  do_clean = TRUE,
  overwrite = TRUE,
  ...
)

Arguments

folder

For downloaded files. Default is a tempdir. Folder is created if it does not exist.

folderout

path for assembled results files, default is what folder was set to.

mystates

default is DC, PR, and the 50 states – lacks VI/GU/MP/AS

do_download

whether to do census2020_download()

do_unzip

whether to do census2020_unzip()

do_read

whether to do census2020_read()

do_clean

whether to do census2020_clean()

overwrite

passed to census2020_download()

...

passed to census2020_read()

Value

invisibly returns a data.table of US Census blocks with columns like blockid lat lon pop area (area in square meters), or intermediate info depending on do_read, do_clean, etc.

Details

  To create certain data tables used by EJAM,
  EJAM uses scripts like EJAM/data-raw/datacreate_....R
  to do something like this:

  blocks <- census2020_get_data()
  mylist <- census2020_save_datasets(blocks)

  bgid2fips    = mylist$bgid2fips
  blockid2fips = mylist$blockid2fips
  blockpoints  = mylist$blockpoints
  blockwts     = mylist$blockwts
  quaddata     = mylist$quaddata

See also

census2020_save_datasets() creates individual data.tables, after census2020_get_data() has done these: