cur_data does not work with lazy_dt
With data.frame
mtcars %>% group_by(cyl) %>% summarise((function(df)df[1,])(cur_data())) %>% as.data.frame
`summarise()` ungrouping output (override with `.groups` argument)
cyl mpg disp hp drat wt qsec vs am gear carb
1 4 22.8 108 93 3.85 2.32 18.61 1 1 4 1
2 6 21.0 160 110 3.90 2.62 16.46 0 1 4 4
3 8 18.7 360 175 3.15 3.44 17.02 0 0 3 2
with lazy_dt
> lazy_dt(mtcars) %>% group_by(cyl) %>% summarise((function(df)df[1,])(cur_data())) %>% as.data.frame
Error: `cur_data()` must only be used inside dplyr verbs.
Run `rlang::last_error()` to see where the error occurred.
>
Session info:
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dtplyr_1.0.1 dplyr_1.0.2
loaded via a namespace (and not attached):
[1] crayon_1.3.4 R6_2.4.1 lifecycle_0.2.0 magrittr_1.5
[5] pillar_1.4.6 rlang_0.4.7 data.table_1.12.8 vctrs_0.3.4
[9] generics_0.0.2 ellipsis_0.3.1 tools_3.6.3 glue_1.4.2
[13] purrr_0.3.3 compiler_3.6.3 pkgconfig_2.0.3 tidyselect_1.1.0
[17] tibble_3.0.3
>
cur_data does not work with lazy_dt
With data.frame
with lazy_dt
Session info: