I have a shapefile with thousands of polygons and a separate csv of additional attribute data. I have joined these by
new_shp <- merge(old_shp, add_data, by.x="ID", by.y="ID")
However, now I want to summarise some attribute fields that have been added by any aggregate function. For instance I want new_shp@data to go from:
small_area large_area age 1 A 50 2 A 40 5 B 40
large_area avg(age) A 45 B 40
with the boundaries now defined by large_area.
Is this possible using R and if not then by any other tool?