Title: | Block Assignment Files |
Version: | 0.0.1 |
Description: | Download and read US Census Bureau data relationship files. Provides support for cleaning and using block assignment files since 2010, as described in https://www.census.gov/geographies/reference-files/time-series/geo/block-assignment-files.html. Also includes support for working with block equivalency files, used for years outside of decennial census years. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.1 |
Imports: | cli, curl, dplyr, fs, glue, readr |
URL: | http://christophertkenny.com/baf/, https://github.com/christopherkenny/baf |
Suggests: | testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2024-06-03 20:19:17 UTC; chris |
Author: | Christopher T. Kenny
|
Maintainer: | Christopher T. Kenny <christopherkenny@fas.harvard.edu> |
Repository: | CRAN |
Date/Publication: | 2024-06-04 16:00:06 UTC |
baf: Block Assignment Files
Description
Download and read US Census Bureau data relationship files. Provides support for cleaning and using block assignment files since 2010, as described in https://www.census.gov/geographies/reference-files/time-series/geo/block-assignment-files.html. Also includes support for working with block equivalency files, used for years outside of decennial census years.
Author(s)
Maintainer: Christopher T. Kenny christopherkenny@fas.harvard.edu (ORCID)
Other contributors:
Cory McCartan corymccartan@nyu.edu (ORCID) [contributor]
See Also
Useful links:
Download Block Assignment Files (BAF) from the Census Bureau
Description
Download Block Assignment Files (BAF) from the Census Bureau
Usage
baf(
state,
year = 2020,
geographies = NULL,
cache_to = baf_download_path(),
overwrite = FALSE
)
Arguments
state |
state to download data for. |
year |
year to download data for. Default is |
geographies |
geography types to download. Default is |
cache_to |
directory name to save the downloaded data. Default is |
overwrite |
Should the data be re-downloaded? Default is |
Value
a list of tibbles for each geography type
Examples
baf('DE', 2020)
Download a file
Description
Download a file
Usage
baf_download(url, path, overwrite = FALSE, quiet = FALSE)
Arguments
url |
a URL |
path |
a file path |
overwrite |
should the file at path be overwritten if it already exists? Default is FALSE. |
quiet |
should output and progress bar be suppressed? |
Value
a path to the downloaded file, invisibly
Examples
tf <- tempfile(fileext = '.zip')
ex <- 'https://www2.census.gov/geo/docs/maps-data/data/baf2020/BlockAssign_ST01_AL.zip'
baf_download(url = ex, path = tf)
Get download location for baf
files
Description
Get download location for baf
files
Usage
baf_download_path()
Value
a path
Examples
baf_download_path()
Clean Block Assignment Files
Description
Clean Block Assignment Files
Usage
clean_bafs(bafs, state = NULL)
Arguments
bafs |
list of block assignment files, named by type |
state |
if provided, adds the first two digits of the state FIPS to each code |
Value
a tibble with two columns
GEOID: block GEOIDs
target: output GEOIDs for the target geography
Examples
baf('WA') |> clean_bafs('WA')