I have a data fram looks like:
I want to add a dummy column based on id group and acp which if acq == 1, then the later year in that group will have a dummy value with 1. something like this :
im trying to doing this in r. i tried with double for loop or dply but all fails. Any help will be appreciated.