df <- tidytable(
  x = 1:3,
  y = 4:6,
  z = c("a", "a", "b")
)
df %>%
  dt(, double_x := x * 2) %>%
  dt(order(-double_x))
# Experimental support for tidy evaluation for custom functions
add_one <- function(data, col) {
  data %>%
    dt(, new_col := {{ col }} + 1)
}
df %>%
  add_one(x)
Run the code above in your browser using DataLab