read_shapefiles: Read in multiple shapefiles

View source: R/reading.R

read_shapefilesR Documentation

Read in multiple shapefiles

Description

Using rgdal::readOGR(), read in one or more shapefiles.

Usage

read_shapefiles(
  filenames,
  filepaths = NULL,
  projection = NULL,
  stringsAsFactors = FALSE
)

Arguments

filenames

Character string or vector of character strings. The filename(s) of the shapefile(s) to read in. May be the full filepath(s) to the shapefile(s), in which case use filepath = NULL. Does not need to include the file extension.

filepaths

Optional character string or vector of character strings. The filepath(s) to the location(s) where the shapefile(s) matching filename is/are stored. Used to locate the file(s) by combining with the filename(s). Must be NULL (will be ignored), a single character vector (if only reading one shapefile or if all shapefiles are in the same location), or the same length as filenames (if the filenames are stored in different locations; the filenames and filepaths are paired by index in filenames and filepaths). Defaults to NULL.

projection

Optional CRS object. The projection to return the shapefile(s) 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.