View source: R/convenience-functions.R
get_shp | R Documentation |
Given a url to a shapefile in a compressed .zip file, download the file and unzip it into a folder in your working directory.
get_shp(url, folder = "shape")
url |
url to download a shapefile. |
folder |
what to name the new folder in your working directory containing the shapefile |
A folder in your working directory with the shapefile; filepaths are printed to the console.
library(sf)
url <- "https://www2.census.gov/geo/tiger/GENZ2019/shp/cb_2019_us_state_20m.zip"
folder <- tempdir()
print(folder)
get_shp(url, folder)
states <- sf::st_read(folder)
head(states)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.