over: over

Description Usage Arguments Note Examples

Description

Define a windowing column.

Usage

1
2
## S4 method for signature 'Column,WindowSpec'
over(x, window)

Arguments

x

a Column, usually one returned by window function(s).

window

a WindowSpec object. Can be created by windowPartitionBy or windowOrderBy and configured by other WindowSpec methods.

Note

over since 2.0.0

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
  df <- createDataFrame(mtcars)

  # Partition by am (transmission) and order by hp (horsepower)
  ws <- orderBy(windowPartitionBy("am"), "hp")

  # Rank on hp within each partition
  out <- select(df, over(rank(), ws), df$hp, df$am)

  # Lag mpg values by 1 row on the partition-and-ordered table
  out <- select(df, over(lead(df$mpg), ws), df$mpg, df$hp, df$am)

## End(Not run)

danzafar/tidyspark documentation built on Sept. 30, 2020, 12:19 p.m.