I have several polygon shapefiles that I need to merge into one using a loop in R. I want to start with an empty shapefile and merge it with the existing shapefiles. All shapefiles will be chacked before the merge that they have the same fields.
I can think of two options:
- create an empty shapefile in ArcMap and read it into R. I tried this with readOGR and got an error:
library(rgdal) EI_GIS_ALL = readOGR(dsn = EI_GIS_ALL_dsn, layer=EI_GIS_ALL_FileName) Error in readOGR(dsn = EI_GIS_ALL_dsn, layer = EI_GIS_ALL_FileName) : no features found
- Create an empty shapefile in R and use union to merge it with existing shapefiles. The union is like in maycca's solution in Merging multiple SpatialPolygonDataFrames into 1 SPDF in R?