Using tinytiger

tinytiger is designed to be low dependency to allow packages and newer R users to use TIGER lines and shapefiles without accruing non-standard dependencies. It has four dependencies: - sf, needed to work with shapefiles - curl, needed for downloading the files from the Census Bureau - cli, used to create clear errors, warnings, and messages. - glue, used for constructing complex URLs and already a dependency of cli

While cli is not necessary, it fits within our goals that tinytiger to be friendly for package development and new users, as cli is one of the most-widely downloaded R packages and comes with but one dependency itself.

Using tinytiger

library(tinytiger)

tinytiger has methods to download TIGER shapes for most Census geographies. A full list are available on the tinytiger website.

To download any shapes, we can use the corresponding function for the geography. All functions are prefixed with tt_.

For counties, for example, we can run:

counties <- tt_counties()
head(counties)
#> Simple feature collection with 6 features and 18 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -123.7283 ymin: 18.11774 xmax: -65.81565 ymax: 46.38562
#> Geodetic CRS:  NAD83
#>   STATEFP COUNTYFP COUNTYNS GEOID        GEOIDFQ        NAME
#> 1      31      039 00835841 31039 0500000US31039      Cuming
#> 2      53      069 01513275 53069 0500000US53069   Wahkiakum
#> 3      35      011 00933054 35011 0500000US35011     De Baca
#> 4      31      109 00835876 31109 0500000US31109   Lancaster
#> 5      31      129 00835886 31129 0500000US31129    Nuckolls
#> 6      72      085 01804523 72085 0500000US72085 Las Piedras
#>                NAMELSAD LSAD CLASSFP MTFCC CSAFP CBSAFP METDIVFP FUNCSTAT
#> 1         Cuming County   06      H1 G4020  <NA>   <NA>     <NA>        A
#> 2      Wahkiakum County   06      H1 G4020  <NA>   <NA>     <NA>        A
#> 3        De Baca County   06      H1 G4020  <NA>   <NA>     <NA>        A
#> 4      Lancaster County   06      H1 G4020   339  30700     <NA>        A
#> 5       Nuckolls County   06      H1 G4020  <NA>   <NA>     <NA>        A
#> 6 Las Piedras Municipio   13      H1 G4020   490  41980     <NA>        A
#>        ALAND   AWATER    INTPTLAT     INTPTLON                       geometry
#> 1 1477563029 10772508 +41.9158651 -096.7885168 MULTIPOLYGON (((-96.55515 4...
#> 2  680980771 61564427 +46.2946377 -123.4244583 MULTIPOLYGON (((-123.7276 4...
#> 3 6016818946 29090018 +34.3592729 -104.3686961 MULTIPOLYGON (((-104.8934 3...
#> 4 2169269688 22850324 +40.7835474 -096.6886584 MULTIPOLYGON (((-96.68493 4...
#> 5 1489645187  1718484 +40.1764918 -098.0468422 MULTIPOLYGON (((-98.2737 40...
#> 6   87748419    32509 +18.1871483 -065.8711890 MULTIPOLYGON (((-65.85703 1...

Other options for downloads are: