I need to erase different vector layers(shapefiles) using R, but I am not sure how to do it in a fast way.
I have 10 different shapefiles and a basemap (also shapefile) that I need to erase my vectors from (I need something equivalent to using the "difference" tool in QGIS).
I know how to do it manually, using the ms_erase
tool, but I was wondering if there is an easy way of iterating this process:
output1 <- ms_erase(basemap, vector1)
output2 <- ms_erase(output1 , vector2)
output3 <- ms_erase(output2 , vector3)
I loaded the vectors using the st_read
function, so their class in R is data.frame.
Thanks, Ines