percent_rank {SparkR} | R Documentation |
Window function: returns the relative rank (i.e. percentile) of rows within a window partition.
percent_rank(x = "missing") ## S4 method for signature 'missing' percent_rank()
x |
empty. Should be used with no argument. |
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.
percent_rank since 1.6.0
Other window_funcs: cume_dist
,
dense_rank
, lag
,
lead
, ntile
,
rank
, row_number
## 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)