get_shp function

Download shapefiles

Download shapefiles

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")

Arguments

  • url: url to download a shapefile.
  • folder: what to name the new folder in your working directory containing the shapefile

Returns

A folder in your working directory with the shapefile; filepaths are printed to the console.

Examples

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)
  • Maintainer: Connor Donegan
  • License: GPL (>= 3)
  • Last published: 2024-12-04