congressional_districts: Download a congressional districts shapefile into R

View source: R/legislative.R

congressional_districtsR Documentation

Download a congressional districts shapefile into R

Description

Description from the US Census Bureau (see link for source): Congressional districts are the 435 areas from which members are elected to the U.S. House of Representatives. After the apportionment of congressional seats among the states, which is based on decennial census population counts, each state with multiple seats is responsible for establishing congressional districts for the purpose of electing representatives. Each congressional district is to be as equal in population to all other congressional districts in a state as practicable. The boundaries and numbers shown for the congressional districts are those specified in the state laws or court orders establishing the districts within each state.

Usage

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

Arguments

state

The two-digit FIPS code (string) of the state you want, or a vector of codes if you want multiple states. Can also be state name or state abbreviation. If NULL (the default), returns the entire United States.

cb

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

resolution

The resolution of the cartographic boundary file (if cb == TRUE). Defaults to '500k'; options include '5m' (1:5 million) and '20m' (1:20 million).

year

the data year; defaults to 2022

...

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

Details

Congressional districts for the 108th through 112th sessions were established by the states based on the result of the 2000 Census. Congressional districts for the 113th through 116th sessions were established by the states based on the result of the 2010 Census. Boundaries are effective until January of odd number years (for example, January 2015, January 2017, etc.), unless a state initiative or court ordered redistricting requires a change. All states established new congressional districts in 2011-2012, with the exception of the seven single member states (Alaska, Delaware, Montana, North Dakota, South Dakota, Vermont, and Wyoming).

The current default in tigris reflects boundaries for the 118th Congress, which is available for years 2022 and 2023. Older congressional district boundaries back to 2011 can be obtained by supplying the appropriate year.

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.

See Also

https://www.census.gov/programs-surveys/geography/guidance/geo-areas/congressional-dist.html

Other legislative district functions: state_legislative_districts(), voting_districts()

Examples

## Not run: 
library(tigris)
library(leaflet)

cd118 <- congressional_districts(cb = TRUE, resolution = '20m', year = 2022)

leaflet(cd118) %>%
   addTiles() %>%
   addPolygons()

## End(Not run)

tigris documentation built on May 29, 2024, 2:20 a.m.