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

dtplyr fails to interpret group_by and sum with na.rm=T #140

Closed
engineerchange opened this issue Jan 14, 2020 · 1 comment
Closed

dtplyr fails to interpret group_by and sum with na.rm=T #140

engineerchange opened this issue Jan 14, 2020 · 1 comment
Labels
bug an unexpected problem or unintended behavior

Comments

@engineerchange
Copy link

engineerchange commented Jan 14, 2020

When using dplyr's group_by function and the base's sum function with the parameter na.rm=TRUE, dtplyr is unable to appropriate translate into data.table lingo.

library(data.table)
library(dtplyr)
library(dplyr,warn.conflicts=FALSE)

packageVersion("data.table")
#> [1] '1.12.8'
packageVersion("dtplyr")
#> [1] '1.0.0.9000'

x1 <- data.frame(x = 1:3, y = c(1,1,2))

x1 %>%
  lazy_dt() %>%
  group_by(y) %>%
  summarise(sum=sum(x,na.rm=T)) %>%
  ungroup() %>%
  as_tibble()
#> Error in eval(jsub[[ii]][[3L]], parent.frame()): object '..T' not found

x1 %>%
  lazy_dt() %>%
  group_by(y) %>%
  summarise(sum=sum(x,na.rm=T)) %>%
  ungroup()
#> Source: local data table [?? x 2]
#> Call:   `_DT2`[, .(sum = sum(x, na.rm = ..T)), keyby = .(y)]
#> Error in eval(jsub[[ii]][[3L]], parent.frame()): object '..T' not found

Created on 2020-01-14 by the reprex package (v0.3.0)

@hadley
Copy link
Member

hadley commented Jan 14, 2020

You can work around this buglet by using TRUE

@engineerchange engineerchange changed the title dtplyr fails to interpret group_by and sum with na.rm dtplyr fails to interpret group_by and sum with na.rm=T May 5, 2020
@hadley hadley added the bug an unexpected problem or unintended behavior label Jan 25, 2021
@hadley hadley closed this as completed in 8354480 Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants