Learn R Programming

tigris (version 2.1)

tracts: Download a Census tracts shapefile into R, and optionally subset by county

Description

Description from the US Census Bureau (see link for source): Census Tracts are small, relatively permanent statistical subdivisions of a county or equivalent entity that are updated by local participants prior to each decennial census as part of the Census Bureau's Participant Statistical Areas Program. The Census Bureau delineates census tracts in situations where no local participant existed or where state, local, or tribal governments declined to participate. The primary purpose of census tracts is to provide a stable set of geographic units for the presentation of statistical data.

Usage

tracts(
  state = NULL,
  county = NULL,
  cb = FALSE,
  resolution = "500k",
  year = NULL,
  ...
)

Arguments

state

The two-digit FIPS code (string) of the state you want. Can also be state name or state abbreviation. When NULL and combined with cb = TRUE, a national dataset of Census tracts will be returned for years 2019 and later.

county

The three-digit FIPS code (string) of the county you'd like to subset for, or a vector of FIPS codes if you desire multiple counties. Can also be a county name or vector of names.

cb

If cb is set to TRUE, download a generalized (1:500k) tracts file. Defaults to FALSE (the most detailed TIGER/Line file)

resolution

The resolution of the cartographic boundary file (if using cb = TRUE). Defaults to '500k'; the other option is '5m' (1:5 million). Resolution of '5m' is #' only available for the national Census tract file for years 2022 and later.

year

the data year; defaults to 2022

...

arguments to be passed to internal function load_tiger, which is not exported. See Additional Arguments.

Additional Arguments

Additional arguments that can be passed in ... are:

  • class Desired class of return object: "sf" (the default) or "sp". sp classes should be considered deprecated as of tigris version 2.0, but legacy support is still available.

  • progress_bar If set to FALSE, do not display download progress bar (helpful for R Markdown documents). Defaults to TRUE.

  • keep_zipped_shapefile If set to TRUE, do not delete zipped shapefile (stored in temporary directory or TIGRIS_CACHE_DIR depending on the configuration of global option "tigris_use_cache"). Defaults to FALSE.

  • refresh Whether to re-download cached shapefiles (TRUE or FALSE) . The default is either FALSE or the value of global option "tigris_refresh" if it is set. Specifying this argument will override the behavior set in "tigris_refresh" global option.

  • filter_by Geometry used to filter the output returned by the function. Can be an sf object, an object of class bbox, or a length-4 vector of format c(xmin, ymin, xmax, ymax) that can be converted to a bbox. Geometries that intersect the input to filter_by will be returned.

Details

Census tracts generally have a population size between 1,200 and 8,000 people, with an optimum size of 4,000 people. A census tract usually covers a contiguous area; however, the spatial size of census tracts varies widely depending on the density of settlement. Census tract boundaries are delineated with the intention of being maintained over a long time so that statistical comparisons can be made from census to census. Census tracts occasionally are split due to population growth or merged as a result of substantial population decline.

Census tract boundaries generally follow visible and identifiable features. They may follow nonvisible legal boundaries, such as minor civil division (MCD) or incorporated place boundaries in some states and situations, to allow for census-tract-to-governmental-unit relationships where the governmental boundaries tend to remain unchanged between censuses. State and county boundaries always are census tract boundaries in the standard census geographic hierarchy.

See Also

https://www2.census.gov/geo/pdfs/reference/GARM/Ch10GARM.pdf

Other general area functions: block_groups(), blocks(), counties(), county_subdivisions(), places(), pumas(), school_districts(), states(), zctas()

Examples

Run this code
if (FALSE) {
library(tigris)
library(leaflet)

tarrant <- tracts("TX", "Tarrant", cb = TRUE)

leaflet(tarrant) %>%
  addTiles() %>%
  addPolygons(popup = ~NAME)
}

Run the code above in your browser using DataLab