Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

roads

Download a roads shapefile into R


Description

From the Census Bureau: "The content of the all roads shapefile includes primary roads, secondary roads, local neighborhood roads, rural roads, city streets, vehicular trails (4WD), ramps, service drives, walkways, stairways, alleys, and private roads."

Usage

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

Arguments

state

The two-digit FIPS code of the state of the county you'd like to download the roads for. Can also be state name or abbreviation (case-insensitive).

county

The three-digit FIPS code of the county you'd like the roads for. Can also be a county name.

year

the data year (defaults to 2019).

...

arguments to be passed to the underlying 'load_tiger' function, which is not exported. Options include class, which can be set to "sf" (the default) or "sp" to request sf or sp class objects, and refresh, which specifies whether or not to re-download shapefiles (defaults to FALSE).

See Also

Other transportation functions: address_ranges(), primary_roads(), primary_secondary_roads(), rails()

Examples

## Not run: 
library(tigris)
library(ggplot2)
library(ggthemes)

roads <- roads("Maine", "031")

gg <- ggplot()
gg <- gg + geom_sf(data = roads,
                   color="black", fill="white", size=0.25)
gg <- gg + theme_map()
gg

## End(Not run)

tigris

Load Census TIGER/Line Shapefiles

v1.0
MIT + file LICENSE
Authors
Kyle Walker [aut, cre], Bob Rudis [ctb]
Initial release
2020-07-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.