Skip to content
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

cur_data gives error? #166

Closed
fkgruber opened this issue Oct 22, 2020 · 1 comment
Closed

cur_data gives error? #166

fkgruber opened this issue Oct 22, 2020 · 1 comment
Labels
dplyr-compat 💞 dplyr compatibility issues feature a feature request or enhancement

Comments

@fkgruber
Copy link

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     
> 
@pskopnik
Copy link

pskopnik commented Dec 1, 2020

Same for cur_group_id(). Probably these methods are simply not implemented yet.

@hadley hadley added dplyr-compat 💞 dplyr compatibility issues feature a feature request or enhancement labels Jan 25, 2021
@hadley hadley closed this as completed in 5bbf1a4 Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dplyr-compat 💞 dplyr compatibility issues feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants