Title: | Mapping Data for 'usmap' Package |
---|---|
Description: | Provides a container for data used by the 'usmap' package. The data used by 'usmap' has been extracted into this package so that the file size of the 'usmap' package can be reduced greatly. The data in this package will be updated roughly once per year as new map data files are provided by the US Census Bureau. |
Authors: | Paolo Di Lorenzo [aut, cre] |
Maintainer: | Paolo Di Lorenzo <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.3.0.9000 |
Built: | 2025-02-18 07:13:43 UTC |
Source: | https://github.com/pdil/usmapdata |
Years for which US map data is available
available_map_years()
available_map_years()
A numeric vector of available map data years, sorted in descending order.
available_map_years()
available_map_years()
Retrieve centroid labels
centroid_labels( regions = c("states", "state", "counties", "county"), as_sf = TRUE, data_year = NULL )
centroid_labels( regions = c("states", "state", "counties", "county"), as_sf = TRUE, data_year = NULL )
regions |
The region breakdown for the map, can be one of
( |
as_sf |
Defunct, this parameter no longer has any effect and will be removed in the future. |
data_year |
The year for which to obtain map data.
If the value is |
An sf
data frame of state or county centroid labels and positions
relative to the coordinates returned by the us_map
function.
Retrieve state and county FIPS codes
fips_data( regions = c("states", "state", "counties", "county"), as_sf = TRUE, data_year = NULL )
fips_data( regions = c("states", "state", "counties", "county"), as_sf = TRUE, data_year = NULL )
regions |
The region breakdown for the map, can be one of
( |
as_sf |
Defunct, this parameter no longer has any effect and will be removed in the future. |
data_year |
The year for which to obtain map data.
If the value is |
An data frame of FIPS codes of the desired regions
.
str(fips_data()) state_fips <- fips_data() county_fips <- fips_data(regions = "counties")
str(fips_data()) state_fips <- fips_data() county_fips <- fips_data(regions = "counties")
Retrieve US map data
us_map( regions = c("states", "state", "counties", "county"), include = c(), exclude = c(), as_sf = TRUE, data_year = NULL )
us_map( regions = c("states", "state", "counties", "county"), include = c(), exclude = c(), as_sf = TRUE, data_year = NULL )
regions |
The region breakdown for the map, can be one of
( |
include |
The regions to include in the resulting map. If |
exclude |
The regions to exclude in the resulting map. If |
as_sf |
Defunct, this parameter no longer has any effect and will be removed in the future. |
data_year |
The year for which to obtain map data.
If the value is |
An sf
data frame of US map coordinates divided by the desired regions
.
str(us_map()) df <- us_map(regions = "counties") west_coast <- us_map(include = c("CA", "OR", "WA")) excl_west_coast <- us_map(exclude = c("CA", "OR", "WA")) ct_counties_as_of_2022 <- us_map(regions = "counties", include = "CT", data_year = 2022)
str(us_map()) df <- us_map(regions = "counties") west_coast <- us_map(include = c("CA", "OR", "WA")) excl_west_coast <- us_map(exclude = c("CA", "OR", "WA")) ct_counties_as_of_2022 <- us_map(regions = "counties", include = "CT", data_year = 2022)
It is usually difficult or inconvenient to create US maps that include both Alaska and Hawaii in a convenient spot. All map data frames produced by this package use the US National Atlas Equal Area projection.
Alaska and Hawaii have been manually moved to a new location so that
their new coordinates place them to the bottom-left corner of
the map. These maps can be accessed by using the us_map
function.
The function provides the ability to retrieve maps with either
state borders or county borders using the regions
parameter
for convenience.
States (or counties) can be included such that all other states (or counties)
are excluded using the include
parameter.
Paolo Di Lorenzo
Email: [email protected]
GitHub: https://github.com/pdil/
Rudis B (2014). “Moving The Earth (well, Alaska & Hawaii) With R.” https://rud.is/b/2014/11/16/moving-the-earth-well-alaska-hawaii-with-r/.
Helpful links:
US Census Shapefiles
https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html
Map Features
https://en.wikipedia.org/wiki/Map_projection
https://en.wikipedia.org/wiki/Equal-area_projection
https://epsg.io/9311