win_over

0th

Percentile

Generate SQL expression for window functions

win_over() makes it easy to generate the window function specification. win_absent(), win_rank(), win_aggregate(), and win_cumulative() provide helpers for constructing common types of window functions. win_current_group() and win_current_order() allow you to access the grouping and order context set up by group_by() and arrange().

Keywords
internal
Usage
win_over(expr, partition = NULL, order = NULL, frame = NULL)

win_rank(f)

win_aggregate(f)

win_aggregate_2(f)

win_cumulative(f)

win_absent(f)

win_current_group()

win_current_order()

win_current_frame()

Arguments
expr

The window expression

order

Variables to order by

frame

A numeric vector of length two defining the frame.

f

The name of an sql function as a string

parition

Variables to partition over

Aliases
  • win_over
  • win_rank
  • win_aggregate
  • win_aggregate_2
  • win_recycled
  • win_cumulative
  • win_absent
  • win_current_group
  • win_current_order
  • win_current_frame
Examples
# NOT RUN {
win_over(sql("avg(x)"))
win_over(sql("avg(x)"), "y")
win_over(sql("avg(x)"), order = "y")
win_over(sql("avg(x)"), order = c("x", "y"))
win_over(sql("avg(x)"), frame = c(-Inf, 0), order = "y")
# }
Documentation reproduced from package dbplyr, version 1.2.1, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.