Is it possible with dplyr or with other R package use any custom cumulative function (i.e. cumulative linear trend, ) for given longitudinal data frame, with next variables:
x - numerical or categorical variable
ID - object ID
t - tenure (1,2,....)
For instance I would like to have linear trend for x[1:2], x[1:3], x[1:4],....for each ID and tenure
in the flexible way (with some dplyr function)