tinytiger
is to provide a lightweight interface to the US Census
Bureau’s TIGER/Line
Shapefiles.
It has four dependencies other than sf
. Download caching is supported;
see below for details.
Install tinytiger
from CRAN with:
install.packages("tinytiger")
You can also install the development version of tinytiger
:
remotes::install_github("alarm-redist/tinytiger")
tinytiger
provides lightweight functions to download Census Bureau
TIGER/Line Shapefiles. To download a geography, simply use the function
corresponding to one of the supported geographies.
library(tinytiger)
tt_counties("NY")
#> Simple feature collection with 62 features and 17 fields
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: -79.76259 ymin: 40.47658 xmax: -71.77749 ymax: 45.01586
#> Geodetic CRS: NAD83
#> # A tibble: 62 × 18
#> STATEFP COUNTYFP COUNT…¹ GEOID NAME NAMEL…² LSAD CLASSFP MTFCC CSAFP CBSAFP
#> * <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 36 101 009741… 36101 Steu… Steube… 06 H1 G4020 236 18500
#> 2 36 091 009741… 36091 Sara… Sarato… 06 H1 G4020 104 10580
#> 3 36 003 009741… 36003 Alle… Allega… 06 H1 G4020 <NA> <NA>
#> 4 36 075 009741… 36075 Oswe… Oswego… 06 H1 G4020 532 45060
#> 5 36 111 009741… 36111 Ulst… Ulster… 06 H1 G4020 408 28740
#> 6 36 089 009773… 36089 St. … St. La… 06 H1 G4020 <NA> 36300
#> 7 36 097 009741… 36097 Schu… Schuyl… 06 H1 G4020 <NA> <NA>
#> 8 36 031 009741… 36031 Essex Essex … 06 H1 G4020 <NA> <NA>
#> 9 36 103 009741… 36103 Suff… Suffol… 06 H1 G4020 408 35620
#> 10 36 041 009741… 36041 Hami… Hamilt… 06 H1 G4020 <NA> <NA>
#> # … with 52 more rows, 7 more variables: METDIVFP <chr>, FUNCSTAT <chr>,
#> # ALAND <dbl>, AWATER <dbl>, INTPTLAT <chr>, INTPTLON <chr>,
#> # geometry <MULTIPOLYGON [°]>, and abbreviated variable names ¹COUNTYNS,
#> # ²NAMELSAD
tt_address_ranges()
: Address Rangestt_ai_an_nh_areas()
: American Indian / Alaska Native / Native Hawaiian Areastt_tribal_subdivisions()
: Tribal Subdivisionstt_anrc()
: Alaskan Native Regional Corporationstt_area_landmarks()
: Area Landmarkstt_area_water():
Area Watertt_block_groups()
: Block Groupstt_cbsa()
: Core Based Statistical Areastt_congressional_districts()
: Congressional Districtstt_new_england_combined_areas()
: Combined New England Towns and Citiestt_coastline()
: Coastlinett_consolidated_cities()
: Consolidated Citiestt_counties()
: Countiestt_county_subdivisions()
: County Subdivisionstt_csa()
: Combined Statistical Areastt_polygon_edges()
: All Polygon Edgestt_elementary_school_districts()
: Elementary School Districts (limited states)tt_estates()
: Estates (Virgin Islands only)tt_polygon_faces()
: All Polygon Facestt_linear_water():
Linear Watertt_metropolitan_divisions()
: Metropolitan Divisionstt_military()
: Military Installationstt_new_england_cities()
: New England Cities and Townstt_new_england_city_divisions()
: New England Cities and Towns Divisionstt_places()
: Census Placestt_point_landmarks()
: Point Landmarkstt_primary_roads()
: Primary Roadstt_primary_secondary_roads()
: Primary and Secondary Roadstt_puma()
: Public Use Microdata Areastt_rails()
: Railroadstt_roads()
: Roadstt_secondary_school_districts()
: Secondary School Districts (limited states)tt_state_leg_lower()
: Lower State Legislative Districtstt_state_leg_upper()
: Upper State Legislative Districtstt_states()
: Statestt_subbarrios()
: Subbarios (Puerto Rico only)tt_blocks()
: Blockstt_tribal_block_groups()
: Tribal Block Groupstt_tracts()
: Tractstt_tribal_tracts()
: Tribal Tractstt_uac()
: : Urban Areastt_unified_school_districts()
: Unified School Districtstt_voting_districts()
: Voting Districtstt_zcta()
: Zip Code Tabulation Areas
By default, downloading will print status messages and/or a progress
bar. For silent downloads, set options(tinytiger.curl_quiet = TRUE)
.
Downloads will go to options(tinytiger.cache_dir)
if it is set. If it
is not, and rappdirs
is installed, and
options(tinytiger.use_cache = TRUE)
, downloads will be cached between
sessions in rappdirs::user_cache_dir("tinytiger")
. If it is not
installed, or if options(tinytiger.use_cache = FALSE)
, then the cache
will be in a temporary directory that does not persist between sessions.
You can check the size of the cache and clear it with tt_cache_size()
and tt_cache_clear()
.