statesRcontiguous provides a tiny (small enough for CRAN) package containing the following shapefiles for the United States of America:
All shapefiles include a column called
contiguous.united.states which allows the dataset to be restricted to the contiguous US very simply:
library(statesRcontiguous) library(leaflet) shp_contiguous_states <- shp_all_us_states %>% filter(contiguous.united.states) leaflet(shp_contiguous_states) %>% addTiles() %>% addPolygons()
This package is currently only available Github, and can be installed as follows:
This package provides only the three shapefiles (states, congressional districts, counties) included in the package. It is intended for where you have a reproducible need for shapefiles for the (contiguous) US and don't want to have to download the files on the fly.
You might prefer to use the tigris package which is available on CRAN, and provides tools to download any of the shapefiles from TIGER.
This package was designed for the University of Oxford's Interactive Data Network which exists to provide a visualisation service for academics at Oxford, using Shiny. The Shiny apps developed by researchers are not allowed to contain data files, instead data must be loaded from external DOI-issuing repositories like Figshare.
By providing a small utility package with these shapefiles in, researchers can easily create choropleth of the US.
The actual shapefiles (borders) included in this package are from the US Census website, do note that they'd been augmented with additional data from other sources which are detailed in the following table
shapefile_details #> # A tibble: 6 x 3 #> description year #> <chr> <int> #> 1 Details about congressional districts 2016 #> 2 Details about counties 2016 #> 3 Details about states 2016 #> 4 Shapefile for congressional districts 2016 #> 5 Shapefile for counties 2016 #> 6 Shapefile for states 2016 #> # ... with 1 more variables: url <chr>
This package includes shapefiles from the US Census Bureau. All shapefiles provided by the US Census Bureau are TIGER/Line shapefiles and are offered to the public free of charge, see TIGER/Line Shapefil Technical Documentation for details.
This package itself is made available under the MIT license.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.