I want to build a map (bus accessibility map) and for that I need to identify some polygons intersections. To do that I have 2 data.frame: batiments (that gives buildings in a city) and arrets_buffer (that gives bus stops (points) with a buffer around the point).
I want to have a column giving the intersect binary result (TRUE or FALSE) in batiments data.frame. I use st_intersects from sf package.
For that I wanted to perform this loop, but it's not a good idea:
for (i in nrow(arrets_buffer)) {
batiments$in_recharges <- st_intersects(x = batiments, arrets_buffer[i,], sparse = FALSE)
}
each time i is incremented, batiments$in_recharges is removed with new values. So at the end I have results for i=nrow(arrets_buffer) only....
No possibility to add a loop in the loop as the number of lines is quite important (the loop will turns a long time..)
Do you have some some idea to help me?
Many thanks for your help
[[alternative HTML version deleted]]