| over {SparkR} | R Documentation |
Define a windowing column.
## S4 method for signature 'Column,WindowSpec' over(x, window) over(x, window)
x |
a Column, usually one returned by window function(s). |
window |
a WindowSpec object. Can be created by |
over since 2.0.0
Other colum_func: alias,
alias,Column-method; between,
between,
between,Column-method; cast,
cast, cast,Column-method;
endsWith, endsWith,
endsWith,Column-method;
otherwise, otherwise,
otherwise,Column-method;
startsWith, startsWith,
startsWith,Column-method;
substr, substr,Column-method
## 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)