lag {SparkR}R Documentation

lag

Description

Window function: returns the value that is 'offset' rows before the current row, and 'defaultValue' if there is less than 'offset' rows before the current row. For example, an 'offset' of one will return the previous row at any given point in the window partition.

Usage

## S4 method for signature 'characterOrColumn'
lag(x, offset, defaultValue = NULL)

lag(x, ...)

Details

This is equivalent to the LAG function in SQL.

See Also

Other window_funcs: cume_dist, cume_dist; dense_rank, dense_rank; lead, lead; ntile, ntile; percent_rank, percent_rank; rank, rank; row_number, row_number

Examples

## Not run: lag(df$c)

[Package SparkR version 1.6.1 Index]