blocks {tigris}R Documentation

Download a Census block shapefile into R

Description

Description from the US Census Bureau (see link for source): Census blocks are statistical areas bounded on all sides by visible features, such as streets, roads, streams, and railroad tracks, and by non-visible boundaries such as city, town, township, and county limits, and short line-of-sight extensions of streets and roads. Generally, census blocks are small in area; for example, a block in a city. Census blocks in suburban and rural areas may be large, irregular and bounded by a variety of features, such as roads, streams, and/or transmission line rights-of-way. In remote areas census blocks may encompass hundreds of square miles. Census blocks cover all territory in the United States, Puerto Rico, and the Island areas. Blocks do not cross the boundaries of any entity for which the Census Bureau tabulates data.

Usage

blocks(state, county = NULL, year = NULL, ...)

Arguments

state

The two-digit FIPS code (string) of the state you want. Can also be state name or state abbreviation.

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.

year

the data year; defaults to 2022

...

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

Details

This function will download an entire block shapefile for a selected state into R, and optionally subset by county. A warning: Census block shapefiles are often very large, especially for large states - for example, the block file for Texas is 462MB zipped! If you have a slow or unreliable internet connection, or insufficient memory, this may prove burdensome given that you have to first download by state and then subset.

Additional Arguments

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

See Also

https://www2.census.gov/geo/pdfs/maps-data/data/tiger/tgrshp2020/TGRSHP2020_TechDoc.pdf

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

Examples

## Not run: 
# Simple example using Rose Island, American Samoa
# Be careful with Census blocks for states!

library(tigris)
library(leaflet)

rose_island <- blocks(state = "AS", county = "Rose Island")

leaflet(rose_island) %>%
  addTiles() %>%
  addPolygons()


## End(Not run)

[Package tigris version 2.1 Index]