read_shapefile: Read in a shapefile

View source: R/reading.R

read_shapefileR Documentation

Read in a shapefile

Description

Using rgdal::readOGR(), read in a shapefile.

Usage

read_shapefile(
  filename,
  filepath = NULL,
  projection = NULL,
  stringsAsFactors = FALSE
)

Arguments

filename

Character string. The filename of the shapefile to read in. May be the full filepath to the shapefile, in which case use filepath = NULL. Does not need to include the file extension.

filepath

Optional character string. The filepath to the location where the shapefile matching filename is stored. Used to locate the file by combining with the filename. Will be ignored if NULL. Defaults to NULL.

projection

Optional CRS object. The projection to return the shapefile in as a CRS object, e.g. sp::CRS("+proj=aea"). Will be ignored if NULL or if it matches the shapefile's existing projection. Defaults to NULL.

stringsAsFactors

Logical. To be passed to rgdal::readOGR(stringsAsFactors). Defaults to FALSE.

Value

Spatial data frame.


nstauffer/aim.analysis documentation built on Nov. 2, 2023, 12:52 a.m.