library(sp)
data(cents)
bb <- bbox(cents)
cb <- rgeos::gBuffer(cents[8, ], width = 0.012, byid = TRUE)
plot(cents)
plot(cb, add = TRUE)
clipped <- gclip(cents, cb)
row.names(clipped)
clipped$avslope # gclip also returns the data attribute
points(clipped)
points(cents[cb,], col = "red") # note difference
Run the code above in your browser using DataLab