Pipeable data.table call.
This function does not use data.table's modify-by-reference.
Has experimental support for tidy evaluation for custom functions.
dt(.df, i, j, ...)A data.frame or data.table
i position of a data.table call. See ?data.table::data.table
j position of a data.table call. See ?data.table::data.table
Other arguments passed to data.table call. See ?data.table::data.table
df <- tidytable(
  x = 1:3,
  y = 4:6,
  z = c("a", "a", "b")
)
df %>%
  dt(, double_x := x * 2) %>%
  dt(order(-double_x))
#> # A tidytable: 3 × 4
#>       x     y z     double_x
#>   <int> <int> <chr>    <dbl>
#> 1     3     6 b            6
#> 2     2     5 a            4
#> 3     1     4 a            2
# Experimental support for tidy evaluation for custom functions
add_one <- function(data, col) {
  data %>%
    dt(, new_col := {{ col }} + 1)
}
df %>%
  add_one(x)
#> # A tidytable: 3 × 4
#>       x     y z     new_col
#>   <int> <int> <chr>   <dbl>
#> 1     1     4 a           2
#> 2     2     5 a           3
#> 3     3     6 b           4