library(dplyr, warn.conflicts = FALSE)
library(dtplyr)
# devtools::load_all("~/GitHub/dtplyr/")
dt <- lazy_dt(tibble(x = 1, y = 2), "DT")
dt %>%
transmute(x = x * 2, y = x + 2, x = y * 4)
#> Source: local data table [1 x 3]
#> Call: DT[, {
#> x <- x * 2
#> y <- x + 2
#> x <- y * 4
#> .(x = x, y = y, x = x)
#> }]
#>
#> x y x
#> <dbl> <dbl> <dbl>
#> 1 16 4 16
#>
#> # Use as.data.table()/as.data.frame()/as_tibble() to access results
dt %>%
as_tibble() %>%
transmute(x = x * 2, y = x + 2, x = y * 4)
#> # A tibble: 1 x 2
#> x y
#> <dbl> <dbl>
#> 1 16 4
Created on 2021-05-19 by the reprex package (v2.0.0)
Created on 2021-05-19 by the reprex package (v2.0.0)