I would like to use R to create an expanded_df
from a template_df
, where each row is repeated by a number of times specified in a separate column in the template_df
, and an integer count is concatenated to the ID column in the expanded_df
, specifying the number this row has been repeated in the expanded_df
.
I would like this count to start at 600 for each ID class.
E.g., template_df
:
Initial_ID Count
a 2
b 3
c 1
d 4
expanded_df
:
Expanded_ID
a-600
a-601
b-600
b-601
b-602
c-600
d-600
d-601
d-602
d-603
Anyone have any ideas? Thanks!