blocks: Download a Census block shapefile into R

Description Usage Arguments Details See Also Examples

View source: R/enumeration_units.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

1
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 year for which you'd like to download data (defaults to 2015).

...

arguments to be passed to the underlying 'load_tiger' function, which is not exported. Options include refresh, which specifies whether or not to re-download shapefiles (defaults to FALSE).

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.

See Also

http://www2.census.gov/geo/pdfs/maps-data/data/tiger/tgrshp2015/TGRSHP2015_TechDoc.pdf

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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)

tigris documentation built on May 29, 2017, 7:23 p.m.