pachterlab / SpatialFeatureExperiment

Extension of SpatialExperiment with sf
https://pachterlab.github.io/SpatialFeatureExperiment
Artistic License 2.0
36 stars 7 forks source link

Allow spatial subsetting with [ like in sf #23

Closed lambdamoses closed 4 months ago

lambdamoses commented 7 months ago

Like described here: https://r.geocompx.org/spatial-operations#spatial-subsetting

However, the difference is that while the sf data frame has a geometry column and another geometry can be used to subset the data frame by row, for SFE, a geometry can be used to subset either rows or columns, though primarily columns. What I want is something more like x[, y, op = st_intersects]. This is a shorthand of something like crop(x, y, colGeometryName = 1L, keep_whole_cg = TRUE) which doesn't crop away the colGeometry items at the boundary (code as in devel version). Burning question though: should rowGeometries, annotGeometries, and images be cropped after subsetting by some colGeometry, as in the crop function?