| Title: | Block Assignment Files | 
| Version: | 0.0.4 | 
| 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.2 | 
| Imports: | cli, curl, dplyr, fs, glue, readr | 
| Depends: | R (≥ 4.2.0) | 
| URL: | http://christophertkenny.com/baf/, https://github.com/christopherkenny/baf | 
| Suggests: | testthat (≥ 3.0.0) | 
| Config/testthat/edition: | 3 | 
| LazyData: | true | 
| NeedsCompilation: | no | 
| Packaged: | 2025-10-14 15:01:17 UTC; chris | 
| Author: | Christopher T. Kenny | 
| Maintainer: | Christopher T. Kenny <ctkenny@proton.me> | 
| Repository: | CRAN | 
| Date/Publication: | 2025-10-14 16:20:02 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 ctkenny@proton.me (ORCID)
Other contributors:
- Cory McCartan mccartan@psu.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 dplyr::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
data('example_baf') |>
  clean_bafs('WA')
Example BAF data from Adams County, WA
Description
list of tibbles with 1,562 rows each
Usage
data('example_baf')
Value
tibble with state identifying information
Examples
data('example_baf')