I have this dataset and I want to group them by Name
delete the second repetition of the verb "eat" , the third repetition of the verb "sleep", and the first repetition of the verb "hit".
u <- data.frame(Name = c("Jon", "Jon", "Jon","Jon", "Bill", "Bill","Bill", "Bill", "Maria","Maria", "Maria", "Maria","Maria", "James", "James"),
Age = c(23, 41, 32, 58, 26, 45,86,13,86,09,23,41,27,06, 42),
verb = c(rep('eat',4),rep('sleep',4), c('go'),c('dislike'), c('pull'),rep('hit',4)))
The output I am looking for is something like:
id Name Age verb
1 Jon 23 eat
3 Jon 32 eat
4 Jon 58 eat
5 Bill 26 sleep
6 Bill 45 sleep
8 Bill 13 sleep
9 Maria 86 go
10 Maria 9 dislike
11 Maria 23 pull
13 Maria 27 hit
14 James 6 hit
15 James 42 hit
Thank you in advance!