shp2df: Import ESRI shapefiles into R data frame

Description Usage Arguments Details Author(s)

Description

Import shapefile and convert into lat/lon coordinates to plot in R or Tableau

Usage

1
2
3
4
shp2df(baseDir = getwd(), folderName = NULL, layerName, exportData = TRUE,
  fileName = layerName, getCentroids = TRUE, labelVar = NA,
  reproject = TRUE,
  projection = "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0")

Arguments

baseDir

string containing the name of the base directotry containing the shapefile

folderName

(optional) string containing the name of the folder within baseDir containing the shapefile. Not required if baseDir contains the full name of the folder containing the shapefile

layerName

string containing the name of the shapefile, e.g. 'district_boundary' for 'district_boundary.shp'. Should not include '.shp'

exportData

Boolean for whether to save the data as a .csv after importing

fileName

string containing the name of the .csv to be exported; by default, will be the same as the inputted .shp file

labelVar

string containing the variable name containing the names of the polygons (for instance, the names of the provinces, districts, etc.)

reproject

Boolean specifying whether to reproject the data

projection

CRS projection string to standardize the projection of the shapefile

Details

View available projections with 'projInfo(type = 'proj')' View available datum with 'projInfo(type = 'datum')' View available ellipsoids with 'projInfo(type = 'ellps')'

Author(s)

Laura Hughes, laura.d.hughes@gmail.com


flaneuse/geocenter documentation built on May 16, 2019, 1:18 p.m.