R SF Clip – Clipping a Layer with a Shape from Another Layer in SF

cliprsf

I would like to get the greens polygons that intersects (or overlapsed) the red outlined polygon (see image below).

I tried sf::st_intersection() but the polygon in yellow (yes that just one polygon) was not taken in account.

In QGIS, the clip (cut) tool did exactly what I wanted. Is there a tool similar in R to cut a layer using another layer ?

Tried to use sf::st_overlaps() but the returned matrix was biggest than my feature table. sf::st_crops() does not fit either as I want to cut in a specific shape.

map issue

Best Answer

sf::st_intersection() will work with the last version of sf (0.7-3). I don't know why it was not working in the previous version.

Related Question