Downloads block geography and merges with the cleaned PL 94-171 file.
pl_tidy_shp(abbr, path, year = 2020, type = c("blocks", "vtds"), ...)
The state to make the shapefile for
The path to the PL files, as in pl_read()
The year to download the block geography for. Should match the year of the PL files.
If "blocks"
, make a Census block shapefile; if "vtds"
make a
VTD shapefile.
passed on to dplyr::filter()
; use to subset to a certain county,
for example.
an sf
object with demographic and shapefile information for the
state.
# \donttest{
pl_ex_path <- system.file("extdata/ri2018_2020Style.pl", package = "PL94171")
pl_tidy_shp("RI", pl_ex_path)
#> Simple feature collection with 569 features and 24 fields (with 569 geometries empty)
#> Geometry type: GEOMETRY
#> Dimension: XY
#> Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
#> Geodetic CRS: NAD83
#> # A tibble: 569 × 25
#> GEOID state county vtd pop pop_h…¹ pop_w…² pop_b…³ pop_a…⁴ pop_a…⁵
#> <chr> <chr> <chr> <chr> <int> <int> <int> <int> <int> <int>
#> 1 44007000101… RI NA 4428… 0 0 0 0 0 0
#> 2 44007000101… RI NA 4428… 0 0 0 0 0 0
#> 3 44007000101… RI NA 4428… 0 0 0 0 0 0
#> 4 44007000101… RI NA 4428… 50 0 50 0 0 0
#> 5 44007000101… RI NA 4428… 0 0 0 0 0 0
#> 6 44007000101… RI NA 4428… 0 0 0 0 0 0
#> 7 44007000101… RI NA 4428… 18 18 0 0 0 0
#> 8 44007000101… RI NA 4428… 0 0 0 0 0 0
#> 9 44007000101… RI NA 4428… 86 86 0 0 0 0
#> 10 44007000101… RI NA 4428… 19 0 0 19 0 0
#> # … with 559 more rows, 15 more variables: pop_nhpi <int>, pop_other <int>,
#> # pop_two <int>, vap <int>, vap_hisp <int>, vap_white <int>, vap_black <int>,
#> # vap_aian <int>, vap_asian <int>, vap_nhpi <int>, vap_other <int>,
#> # vap_two <int>, area_land <dbl>, area_water <dbl>,
#> # geometry <GEOMETRYCOLLECTION [°]>, and abbreviated variable names
#> # ¹pop_hisp, ²pop_white, ³pop_black, ⁴pop_aian, ⁵pop_asian
# }