row_number {SparkR}R Documentation

row_number

Description

Window function: returns a sequential number starting at 1 within a window partition.

Usage

row_number(x = "missing")

## S4 method for signature 'missing'
row_number()

Arguments

x

empty. Should be used with no argument.

Details

This is equivalent to the ROW_NUMBER function in SQL.

Note

row_number since 1.6.0

See Also

Other window_funcs: cume_dist, dense_rank, lag, lead, ntile, percent_rank, rank

Examples

## Not run: 
##D   df <- createDataFrame(mtcars)
##D   ws <- orderBy(windowPartitionBy("am"), "hp")
##D   out <- select(df, over(row_number(), ws), df$hp, df$am)
## End(Not run)

[Package SparkR version 2.1.2 Index]