percent_rank {SparkR}R Documentation

percent_rank

Description

Window function: returns the relative rank (i.e. percentile) of rows within a window partition.

Usage

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

percent_rank(x = "missing")

Arguments

x

empty. Should be used with no argument.

Details

This is computed by:

(rank of row in its partition - 1) / (number of rows in the partition - 1)

This is equivalent to the PERCENT_RANK function in SQL.

Note

percent_rank since 1.6.0

See Also

Other window_funcs: cume_dist, cume_dist, cume_dist,missing-method; dense_rank, dense_rank, dense_rank,missing-method; lag, lag, lag,characterOrColumn-method; lead, lead, lead,characterOrColumn,numeric-method; ntile, ntile, ntile,numeric-method; rank, rank, rank, rank,ANY-method, rank,missing-method; row_number, row_number, row_number,missing-method

Examples

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

[Package SparkR version 2.2.0 Index]