baf

The goal of baf is to provide lightweight block assignment (and equivalence) files from the US Census Bureau.

Installation

You can install the development version of baf like so:

# pak::pak('christopherkenny/baf')
install.packages("baf", repos = c('https://christopherkenny.r-universe.dev', 'https://cloud.r-project.org'))

Example

The workhorse function for baf is the baf() function.

library(baf)

baf(state = 'NM', year = 2024, geographies = 'cd')
#> $CD118
#> # A tibble: 107,215 × 2
#>    GEOID           CDFP 
#>    <chr>           <chr>
#>  1 350010001071000 01   
#>  2 350010001071001 01   
#>  3 350010001071002 01   
#>  4 350010001071003 01   
#>  5 350010001071004 01   
#>  6 350010001071005 01   
#>  7 350010001071006 01   
#>  8 350010001071007 01   
#>  9 350010001071008 01   
#> 10 350010001071009 01   
#> # ℹ 107,205 more rows

Cache

By default, baf loads files to a temporary directory. To retain files across sessions, set the cache_to argument to a directory of your choosing. You can also set options(baf.use_cache = TRUE) to create a user-level cache that can persist across projects.