Many users have asked how to check whether polygons intersect, however, current answers to those questions are not working for my case.
I have two objects. One is a "Large SpatialPolygons" named "farms". This object has several polygons (total of 2011), and each polygon indicates the limits of a different farm (see print screen).
My second object is a "Large SpatialPolygons DataFrame" named slope_RJ_100m. That object divides a large area into several square polygons with area of 10.000m^2 each (total of 310000 polygons).
For each of the squares (polygons) in "slope_RJ_100m", I would like to know whether they intersect any of the polygons in "farms". In other words, I want to know whether each particular square in "slope_RJ_100m" has a farm inside (even if just a piece of a farm). I was expecting the outcome to be something with 310000 rows and two variables, one indicating the polygon in slope_RJ_100m, and the other with TRUE or FALSE for whether that polygon has a farm.
I have tried:
inters = gIntersection(slope_RJ_100m, farms)
This one produces an output of about 1500 polygons. I am not sure how to use this to know which of my 310000 polygons has a farm in it.
inters = raster::intersect(slope_RJ_100m, farms)
The output has 29144 polygons. As in the previous case, not sure how I can use this to know whether the square has a farm.
and
inters = st_intersects(slope_RJ_100m, farms)
Error in UseMethod("st_intersects") : no applicable method for 'st_intersects' applied to an object of class "c('SpatialPolygonsDataFrame', 'SpatialPolygons', 'Spatial', 'SpatialPolygonsNULL', 'SpatialVector', 'SPNULL')"
I am sure my question is trivial and I apologize beforehand.

