-
Notifications
You must be signed in to change notification settings - Fork 3
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indexing for arbitrary elements of dimensions #107
Comments
Indexing with numeric vectors is difficult since the elements become flattened by default, unlike with lists > c(1:2, 2, 1)
[1] 1 2 2 1
> list(1:2, 2, 1)
[[1]]
[1] 1 2
[[2]]
[1] 2
[[3]]
[1] 1 Perhaps you can do something fancy with The vector vs. list issue aside, there is this outstanding need to support integer indexing: #43 However at the moment, you could turn lists of integers into lists of slices in order to work around this: to_slice <- function(i) {
if(length(i) == 1) {
return(slice(i, i))
}
if(length(i) == 2) {
return(slice(i[1], i[2]))
}
if(length(i) == 3) {
return(slice(i[1], i[2], i[3]))
}
stop("Received indexing vector with too many elements")
}
selection <- z$get_item(lapply(x, to_slice)) |
We also have this bracket indexing function which may be relevant: Line 1213 in f84355d
z[2, 5] Example in test here: https://github.com/keller-mark/pizzarr/blob/main/tests/testthat/test-s3.R#L47 |
Here is have to updated and implemented further right ? I will attempt if you guys haven't planned yet. Lines 88 to 100 in f84355d
|
I like the fact that this repo is functionally an R replica of the original Here is more info on our Here are some examples:
Would you guys like a PR on this once everything is tidy ? |
@keller-mark has the final say, but I'd be happy to get the contribution! |
I agree with @dblodgett-usgs, the contribution is welcome! Compatibility with DelayedArray would be great! |
Awesome guys, thanks for the quick response, I will let you know! |
User story
Hey there,
Is it possible to access arbitrary elements of dimensions (like it is done in Rarr with index arguement) instead of using
slice
. Is this already implemented or not available at the moment ?It is possible to access a single element.
But with multiple elements, it doesnt work.
The text was updated successfully, but these errors were encountered: