tigris | R Documentation |
tigris is an R package that allows users to directly download and use TIGER/Line and cartographic boundary shapefiles from the US Census Bureau in R. For an overview of the package, visit its repository at https://github.com/walkerke/tigris or read Chapter 5 of the book Analyzing US Census Data: Methods, Maps, and Models in R at https://walker-data.com/census-r/census-geographic-data-and-applications-in-r.html.
Use option tigris_use_cache
to tell tigris
to cache
Census shapefile downloads. This is FALSE
by default. e.g.
options(tigris_use_cache=TRUE)
Use option tigris_refresh
to force a refresh of cached tigris
Shapefiles. e.g. options(tigris_refresh=TRUE)
Use option tigris_year
to change the year for which you'd like to download data.
e.g. options(tigris_year = 2017)
. The default year for the package is 2022.
Use option tigris_class
to specify the class of spatial object you'd like returned.
The default is "sf"
for simple features objects. If you'd like a legacy object
of class Spatial*DataFrame
, use options(tigris_class = "sp")
. Please note
that legacy sp objects are no longer formally supported in tigris.
Use the protocol
argument in data download functions to specify whether to use FTP or HTTP
for downloading files. The default is "ftp"
, which may work better in some environments
where HTTPS connections are restricted. For HTTPS downloads, use protocol = "http"
.
Use the timeout
parameter to control the timeout for downloading large files when the protocol is FTP. The default is
1800 seconds (30 minutes), which should be sufficient for most files. If you're downloading particularly
large files or have a slow connection, you may need to increase this value.
Several options
and arguments control behavior of various tigris
functions.
See Details
for more information.
Kyle Walker (@kyle_e_walker)
Useful links:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.