The yellow polygon doesn't "fit into" the red outline. It intersects or overlaps it. "Fit into" to me means "is fully inside". These are very complex looking polygons and its possible some validity constraint isn't valid and we can't tell that without your data....
– SpacedmanApr 4 at 19:41

Thanks for your comments. I'm well aware that the yellow polygon does not fit into I want either selected it (by an intersection) or get the part inside the red outlined polygon (by cutting it). Actually sf::st_intersects() miss the yellow polygon (and so does QGIS geoprocessing tool). I'm not a native english speaker so I might have misused the word "fit". Actually, I started by an intersection by habit, and because I didn't thought there will be big polygons like this one, but cutting is more what I need for this use case. So my question is still valid.
– Nicolas RoelandtApr 5 at 7:25

@spacedSparking, I'm surprised too. I checked the validity of the polygons and all are valids. Actually the green and the yellow are in the same layer, I just highlighted the problematic polygon.
– Nicolas RoelandtApr 5 at 8:53

I had {sf} 0.7.2; upgraded to {sf} 0.7.3 and the issue with sf::st_intersect() was resolved. Not sign in the changelog that the algorithm was changed, maybe the new grob operator ? ¯_(ツ)_/¯ Thanks @rcarto
– Nicolas RoelandtApr 5 at 14:05

There is now a sf::st_crop function available but, you may need the development github version of sf. You can download the development version using the devtools/remotes package(s).

install.packages("devtools")
remotes::install_github("r-spatial/sf")

For specific irregular geometries, the raster::intersect function can clip data, and retain attributes, using the rgeos package. I believe that the package can handle sf class objects but, if not, you can coerce to sp using as(x, "Spatial").

Thanks for your comments. As I said, sf::st_crop() does not respond to my need as it takes a bounding box (so 4 coordinates). I want to cut with another (irregular) shape from another layer. I'll look into raster::intersect
– Nicolas RoelandtApr 5 at 7:32