At the moment, I am trying to apply a function that computes in some way a lagged data, this function has to be applied on various sets of groups an