Goodmorning to everyone, I have a df composed like that
df=data.frame("Description"=c("Miriam","Miriam","Miriam","Trump","Trump","Trump","Right","Right","Right","Sara","Sara","Star","Star","Star","Sandra"))
I would like to creare a loop that create a new column in which is assigned a sample number to each sample with the same name, thus to obtain this result:
Description SampleID
Miriam sample1
Miriam sample1
Miriam sample1
Trump sample2
Trump sample2
Trump sample2
Right sample3
Right sample3
Right sample3
Sara sample4
Sara sample4
Star sample5
Star sample5
Star sample5
Sandra sample6
Does anyone know how to do that? Thanks a lot to everyone will help. Andrea