We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
group_by()
transmute()
library(dplyr, warn.conflicts = FALSE) library(dtplyr) df <- tibble(x = 1) %>% group_by(x) # grouping variable cannot be selected df %>% lazy_dt() %>% transmute(y = 2) %>% .$vars #> [1] "y" df %>% transmute(y = 2) #> # A tibble: 1 x 2 #> # Groups: x [1] #> x y #> <dbl> <dbl> #> 1 1 2 # transmuting a grouping variable df %>% lazy_dt() %>% transmute(x = x + 1, y = 2) #> Source: local data table [1 x 3] #> Groups: x #> Call: `_DT2`[, .(x = x + 1, y = 2), keyby = .(x)] #> #> x x y #> <dbl> <dbl> <dbl> #> 1 1 2 2 #> #> # Use as.data.table()/as.data.frame()/as_tibble() to access results df %>% transmute(x = x + 1, y = 2) #> # A tibble: 1 x 2 #> # Groups: x [1] #> x y #> <dbl> <dbl> #> 1 2 2 # mutating works correctly df %>% lazy_dt() %>% mutate(x = x + 1, y = 2) #> Source: local data table [1 x 2] #> Groups: x #> Call: copy(`_DT3`)[, `:=`(x = x + 1, y = 2), by = .(x)] #> #> x y #> <dbl> <dbl> #> 1 2 2 #> #> # Use as.data.table()/as.data.frame()/as_tibble() to access results df %>% mutate(x = x + 1, y = 2) #> # A tibble: 1 x 2 #> # Groups: x [1] #> x y #> <dbl> <dbl> #> 1 2 2 # grouping variable cannot be renamed lazy_dt(tibble(x = 1, y = 2)) %>% group_by(z = x) %>% summarise(y = mean(y)) %>% show_query() #> `_DT4`[, .(y = mean(y)), keyby = .(z)] tibble(x = 1, y = 2) %>% group_by(z = x) %>% summarise(y = mean(y)) #> # A tibble: 1 x 2 #> z y #> <dbl> <dbl> #> 1 1 2
Created on 2021-05-19 by the reprex package (v2.0.0)
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Created on 2021-05-19 by the reprex package (v2.0.0)
The text was updated successfully, but these errors were encountered: