You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thinking of rray as a tidyverse citizen, a couple of ideas came to my mind. I will put them in sepparate issues so as they can be independently commented on, dismissed or kept as future posible features.
The first one is the use of tidyselect in rray indexes. To do things like:
x[y2011:y2019, -NY]
As an appetizer I have done a dummy trial (for the simpler case of rray_slice instead of rray_subset ):
library(rray)
#> Warning: package 'rray' was built under R version 3.5.3
library(vctrs)
#> Warning: package 'vctrs' was built under R version 3.5.3
library(rlang)
#> Warning: package 'rlang' was built under R version 3.5.3
library(tidyselect)
#> Warning: package 'tidyselect' was built under R version 3.5.3funrray_slice<-function (x, i, axis) {
i<- vars_select(dimnames(x)[[axis]],!!enquo(i))
axis<- vec_cast(axis, integer())
rray:::validate_axis(axis, x)
indexer<-rray:::front_pad(i, axis)
rray_subset(x, !!!indexer)
}
x<- rray(1:8,c(2,4),list(c("A","B"),letters[1:4]))
funrray_slice(x, -b , axis=2)
#> <rray<int>[,3][6]>#> a c d#> A 1 5 7#> B 2 6 8# I wasn`t seeking it, but one of the goodies of tidyselect# solves the issue of easy referencing the end of axis:
funrray_slice(x, 1:last_col() , axis=2)
#> <rray<int>[,4][8]>#> a b c d#> A 1 3 5 7#> B 2 4 6 8
This enhancement is only applicable to "Fully and Uniquely Named" rrays ("funrrays"; not to mean that numeric-index based rrays are boring ;).
I dont know if they deserve their own class or even their own package. I'd rather see rray supply all this names based functionality seamlessly. With names, more thing become possible and rray can make inroads into dplyr territory taking there its own strong points.
The text was updated successfully, but these errors were encountered:
Thinking of rray as a tidyverse citizen, a couple of ideas came to my mind. I will put them in sepparate issues so as they can be independently commented on, dismissed or kept as future posible features.
The first one is the use of tidyselect in rray indexes. To do things like:
x[y2011:y2019, -NY]
As an appetizer I have done a dummy trial (for the simpler case of rray_slice instead of rray_subset ):
Created on 2019-05-29 by the reprex package (v0.2.1)
This enhancement is only applicable to "Fully and Uniquely Named" rrays ("funrrays"; not to mean that numeric-index based rrays are boring ;).
I dont know if they deserve their own class or even their own package. I'd rather see rray supply all this names based functionality seamlessly. With names, more thing become possible and rray can make inroads into dplyr territory taking there its own strong points.
The text was updated successfully, but these errors were encountered: