Link an object coercible to an s2_cell vector with the closest census block group using the US Census TIGER/Line shapefiles from a specific year.
Usage
get_tiger_bg(x, year = as.character(2024:2013), ...)Arguments
- x
object coercible to an s2_cell vector; non-missing cells must be full-resolution (level 30) cells
- year
vintage of TIGER/Line block group geography files
- ...
passed to
stow::stow(). Thepackageandsubdirarguments are fixed by geomarker.
Value
An unnamed character vector of matched census block group identifiers, with one element per input cell in the same order. Duplicate and missing input cells retain their original positions.
Examples
local({
withr::local_envvar(
R_USER_DATA_DIR = fs::path_package("geomarker", "gmrkr--8841"),
R_GEOMARKER_NO_DOWNLOAD = "true"
)
set.seed(123)
print(get_tiger_bg(s2cd_example_cincy(8L)))
})
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_tiger_bg/06296316600dba02--tl_2024_us_state.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_tiger_bg/a8e89a32aa0a516f--tl_2024_21_bg.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_tiger_bg/a8e89a32aa0a516f--tl_2024_39_bg.zip
#> [1] "210239502002" "390250410011" "391650312001" "390159515003" "211170655021"
#> [6] "391650308004" "211919303002" "391650319051"