HelenaLC / SpatialData

15 stars 7 forks source link

element-wise and object-wide subsetting à la `[` #78

Open HelenaLC opened 2 days ago

HelenaLC commented 2 days ago
HelenaLC commented 1 day ago

1st attempt at implementation in v0.99.14, currently omitting k. I.e., only layers and elements can be subsetted directly, not the contents of any element. E.g.,

x <- file.path("extdata", "blobs.zarr")
x <- system.file(x, package="SpatialData")
x <- readSpatialData(x, tables=FALSE)

# layers are taken in order of appearance
# (images, labels, points, shapes, tables)
x[-4] # drop layer
x[4, -2] # drop element
x["shapes", c(1, 3)] # subset layer
x[c(1, 2), list(1, c(1, 2))] # multiple