I have a regional shapefile of England and Wales but without containing Scotland and Northern Ireland.
I want to add the outlines of Scotland and Northern Ireland in without regional divisions so the combined would consist of the following polygons:
- London
- North-West
- North-East
- East of England
- East Midlands
- West Midlands
- South-West
- South-East
- Yorkshire & The Humber
- Scotland
- Northern Ireland
I have a separate shapefile with just the country border of Scotland and Ireland – my question is it possible to add this to my regions map and if so how can I do so in R?
Best Answer
You can use
rbind
to combine spatial data objects:Read in a couple of shapefiles:
Try using
rbind
:This has failed because there's a different number of columns in each shapefile - you can't put data with four columns (fields) with data that has three columns:
Fix this some way. I'll remove the
N
column fromla
:And now it works:
Giving me an object with the total features:
So you do need to make sure your objects have identically-named columns, which you'll have to do by removing, adding, or renaming columns. Then you can
rbind
them together.