I am an ArcGIS user trying to get to grips with R and the way it handles spatial data.
I've got two spatial data objects:
class : SpatialPolygonsDataFrame
features : 1
extent : 0.1353, 0.1376, 51.5668, 51.5678 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
variables : 2
names : X_leaflet_id, feature_type
value : 81, polygon
and
class : SpatialPolygonsDataFrame
features : 1
extent : 0.1386686, 0.1392818, 51.56686, 51.56768 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
variables : 6
names : NAME, CODE, Shape_Length, Shape_Area, Attrib1, Attrib2
value : Example polygon, CodeP1, 0.002631075, 3.91693e-07, My first attribute, 999
Note that the attributes of these objects are different. In my final analysis I will add attributes to the first object to align with the second.
How can I append or bind the first polygon as a record to the second, as an individual row? Note I'm not trying to do anything clever here, like a spatial analysis such as point in polygon. I just want to append the first polygon to the dataset that the second is held in, and I can't find out how.
data.frame
of both spatial objects, in sense that they have exactly the same tabular structure, you can userbind
which has a method for thesp
class. You can read the help page of the function by running?rbind
in an r console