Useful in cases where two sets of polygons do not align perfectly spatially. Thus, intersecting produces slivers that are larger than can typically be easily dealt with (e.g., https://github.com/r-spatial/sf/issues/547).
intersect_clean(x, y, xcol, areaThresh = 0.05)sf polygons object
In these cases, deal with each of the set of features individually:
Identify the feature sets of interest in x using the unique values of x[[xcol]]
(i.e., sets of polygons that share an identifier);
For each of the feature sets, calculate the area of the smallest feature in that set;
For each of the feature sets, perform intersection with y and ensure validity;
Post-intersection, remove any fragment polygons smaller than areaThresh * min(area).