I have this dataset in R:
and I want to change the data according to nb variable, it means ID = 1 will have 5 rows and ID=2 will have 12 rows as shown below:
is there any R function that I could use it to transform my data :) ?
Thanks in advance

