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

us_map

Retrieve US map data


Description

Retrieve US map data

Usage

us_map(
  regions = c("states", "state", "counties", "county"),
  include = c(),
  exclude = c()
)

Arguments

regions

The region breakdown for the map, can be one of ("states", "state", "counties", "county"). The default is "states".

include

The regions to include in the resulting map. If regions is "states"/"state", the value can be either a state name, abbreviation or FIPS code. For counties, the FIPS must be provided as there can be multiple counties with the same name. If states are provided in the county map, only counties in the included states will be returned.

exclude

The regions to exclude in the resulting map. If regions is "states"/"state", the value can be either a state name, abbreviation or FIPS code. For counties, the FIPS must be provided as there can be multiple counties with the same name. The regions listed in the include parameter are applied first and the exclude regions are then removed from the resulting map. Any excluded regions not present in the included regions will be ignored.

Value

A data frame of US map coordinates divided by the desired regions.

Examples

str(us_map())

df <- us_map(regions = "counties")
west_coast <- us_map(include = c("CA", "OR", "WA"))

south_atl_excl_FL <- us_map(include = .south_atlantic, exclude = "FL")

usmap

US Maps Including Alaska and Hawaii

v0.5.2
GPL-3 | file LICENSE
Authors
Paolo Di Lorenzo [aut, cre]
Initial release

We don't support your browser anymore

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