File: win_over.Rd

package info (click to toggle)
r-cran-dbplyr 2.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,376 kB
  • sloc: sh: 13; makefile: 2
file content (70 lines) | stat: -rw-r--r-- 1,710 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/translate-sql-window.R, R/backend-teradata.R
\name{win_over}
\alias{win_over}
\alias{win_rank}
\alias{win_aggregate}
\alias{win_aggregate_2}
\alias{win_recycled}
\alias{win_cumulative}
\alias{win_absent}
\alias{win_current_group}
\alias{win_current_order}
\alias{win_current_frame}
\alias{win_rank_tdata}
\title{Generate SQL expression for window functions}
\usage{
win_over(
  expr,
  partition = NULL,
  order = NULL,
  frame = NULL,
  con = sql_current_con()
)

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()

win_rank_tdata(f)
}
\arguments{
\item{expr}{The window expression}

\item{order}{Variables to order by}

\item{frame}{A numeric vector of length two defining the frame.}

\item{f}{The name of an sql function as a string}

\item{parition}{Variables to partition over}
}
\description{
\code{win_over()} makes it easy to generate the window function specification.
\code{win_absent()}, \code{win_rank()}, \code{win_aggregate()}, and \code{win_cumulative()}
provide helpers for constructing common types of window functions.
\code{win_current_group()} and \code{win_current_order()} allow you to access
the grouping and order context set up by \code{\link[=group_by]{group_by()}} and \code{\link[=arrange]{arrange()}}.
}
\examples{
con <- simulate_dbi()

win_over(sql("avg(x)"), con = con)
win_over(sql("avg(x)"), "y", con = con)
win_over(sql("avg(x)"), order = "y", con = con)
win_over(sql("avg(x)"), order = c("x", "y"), con = con)
win_over(sql("avg(x)"), frame = c(-Inf, 0), order = "y", con = con)
}
\keyword{internal}