Being more or less a beginner in R, I have a quick question. Indeed, I would like to attach a series of elements (country number) to different categories (n°id). The idea is as follows: as soon as a country number belongs 3 times in a row to a certain id number, it is attached to this id number. Here is a simplified example below:
Starting database Desired outcome
I think I can do this using the R program, although I couldn't find similar questions on the different forums.
Thank you very much for your help,
Gauthier