r - How does dplyr::do work with data.table -
the dplyr::do
not seem work data.table
:
# works data.frame(1) %>% do(data.frame(1)) ## x1 ## 1 1 # same data.table not work data.table(1) %>% do(data.frame(1)) ## error in do_.data.table(.data, .dots = lazyeval::lazy_dots(...)) : ## argument ".f" missing, no default
some investigation lead functions do
, do_.data.table
:
do ## function (.data, ...) ## { ## do_(.data, .dots = lazyeval::lazy_dots(...)) ## } ## <environment: namespace:dplyr> dplyr:::do_.data.table ## function (.data, .f, ...) ## { ## list(.f(as.data.frame(.data), ...)) ## } ## <environment: namespace:dplyr>
how work? arguments of do_.data.table
not compatible gets do
. , result of do_.data.table
list instead of data.frame
. how use do
or do_
data.table
input?
i know can use df %>% data.frame %>% do(...)
, hoping direct solution.
it looks do_
.f
arguments , return in list.
data.table(1) %>% do_(data.frame(2), data.frame(3), .f = function(x1, x2, x3) cbind(x1, x2, x3)) # [[1]] # v1 x2 x3 # 1 1 2 3
don't know do
though.
Comments
Post a Comment