Override window order and frame

window_order(.data, ...)

window_frame(.data, from = -Inf, to = Inf)

Arguments

.data

A remote tibble

...

Name-value pairs of expressions.

from, to

Bounds of the frame.

Examples

library(dplyr) df <- lazy_frame(g = rep(1:2, each = 5), y = runif(10), z = 1:10) df %>% window_order(y) %>% mutate(z = cumsum(y)) %>% sql_build()
#> <SQL SELECT> #> From: df #> Select: "g", "y", sum("y") OVER (ORDER BY "y" ROWS UNBOUNDED PRECEDING) AS "z"
df %>% group_by(g) %>% window_frame(-3, 0) %>% window_order(z) %>% mutate(z = sum(x)) %>% sql_build()
#> Warning: Missing values are always removed in SQL. #> Use `sum(x, na.rm = TRUE)` to silence this warning
#> <SQL SELECT> #> From: df #> Select: "g", "y", sum("x") OVER (PARTITION BY "g" ORDER BY "z" ROWS 3 PRECEDING) AS "z"