krangl / krangl / lead

lead

fun DataCol.lead(n: Int = 1, default: Any? = null): DataCol

Returns the "next" column values. Useful for comparing values ahead of the current values.

Also see https://dplyr.tidyverse.org/reference/lead-lag.html

Parameters

n - positive integer, giving the number of positions to lead by (defaults to 1)