over {SparkR}R Documentation

over

Description

Define a windowing column.

Usage

over(x, window)

## 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

See Also

Other colum_func: alias(), between(), cast(), endsWith(), otherwise(), startsWith(), substr()

Examples

## Not run: 
##D   df <- createDataFrame(mtcars)
##D 
##D   # Partition by am (transmission) and order by hp (horsepower)
##D   ws <- orderBy(windowPartitionBy("am"), "hp")
##D 
##D   # Rank on hp within each partition
##D   out <- select(df, over(rank(), ws), df$hp, df$am)
##D 
##D   # Lag mpg values by 1 row on the partition-and-ordered table
##D   out <- select(df, over(lead(df$mpg), ws), df$mpg, df$hp, df$am)
## End(Not run)

[Package SparkR version 3.0.0 Index]