Retrieve US map data
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 theinclude
parameter are applied first and theexclude
regions are then removed from the resulting map. Any excluded regions not present in the included regions will be ignored.
See also
usmapdata::us_map()
of which this function is a wrapper for.
Examples
str(us_map())
#> 'data.frame': 13663 obs. of 9 variables:
#> $ x : num 1091779 1091268 1091140 1090940 1090913 ...
#> $ y : num -1380695 -1376372 -1362998 -1343517 -1341006 ...
#> $ order: int 1 2 3 4 5 6 7 8 9 10 ...
#> $ hole : logi FALSE FALSE FALSE FALSE FALSE FALSE ...
#> $ piece: int 1 1 1 1 1 1 1 1 1 1 ...
#> $ group: chr "01.1" "01.1" "01.1" "01.1" ...
#> $ fips : chr "01" "01" "01" "01" ...
#> $ abbr : chr "AL" "AL" "AL" "AL" ...
#> $ full : chr "Alabama" "Alabama" "Alabama" "Alabama" ...
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")