I want to do the same as in this question asked:
Assigning dummy values based on previous occurrences in R
BUT I want not only that the column "dummycount" takes the value 1 for the occurrence in the previous year in column "dummy" but also in the same year of the occurrence.
can you help me, please?