Skip to content

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

Closed
@engineerchange

Description

@engineerchange

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions