library(dplyr, warn.conflicts = FALSE)
db <- memdb_frame(x = 1:5, y = 5:1)
db %>%
mutate(a = (x + y) / 2, b = sqrt(x^2L + y^2L)) %>%
show_query()
# dbplyr automatically creates subqueries as needed
db %>%
mutate(x1 = x + 1, x2 = x1 * 2) %>%
show_query()
Run the code above in your browser using DataLab