Hello everyone,
I am all IN for a better integration of DT in the tidyverse ecosystem. DT is really great and I think some features of the tidyverse could be very useful in a DT setting.
In particular, I am a huge fan of purrr and list columns. Consider this.
> tibble(group = c(1,1,1,2,2,2),
+ val = list(list(1,2,3),list(1,2,3),list(1,2,3),
+ list(1,2,3),list(1,2,3),list(1,2,3)))
# A tibble: 6 x 2
group val
<dbl> <list>
1 1 <list [3]>
2 1 <list [3]>
3 1 <list [3]>
4 2 <list [3]>
5 2 <list [3]>
6 2 <list [3]>
As you can see, I can clearly see the dimension (or length) of each element of the list-column.
As far as I know, this is not possible with DT
> data.table(group = c(1,1,1,2,2,2),
+ val = list(list(1,2,3),list(1,2,3),list(1,2,3),
+ list(1,2,3),list(1,2,3),list(1,2,3)))
group val
1: 1 <list>
2: 1 <list>
3: 1 <list>
4: 2 <list>
5: 2 <list>
6: 2 <list>
This is a bit unfortunate. Here the idea is to use furrr (which leverages purrr) to easily run computations in parallel across the list columns.
> mydf[, newval := future_map(val, ~length(.x))]
> mydf
group val newval
1: 1 <list> 3
2: 1 <list> 3
3: 1 <list> 3
4: 2 <list> 3
5: 2 <list> 3
6: 2 <list> 3
Being able to see the dimension of the embedded list (or DT) is very important when one creates list columns with whole data.frames and run regressions on them. What do you think? Could the printing of DT show an output similar to the printing of the tibble?
Thanks!
Hello everyone,
I am all IN for a better integration of DT in the
tidyverseecosystem. DT is really great and I think some features of thetidyversecould be very useful in a DT setting.In particular, I am a huge fan of
purrrandlist columns. Consider this.As you can see, I can clearly see the dimension (or length) of each element of the list-column.
As far as I know, this is not possible with DT
This is a bit unfortunate. Here the idea is to use
furrr(which leveragespurrr) to easily run computations in parallel across the list columns.Being able to see the dimension of the embedded list (or DT) is very important when one creates list columns with whole data.frames and run regressions on them. What do you think? Could the printing of DT show an output similar to the printing of the tibble?
Thanks!