This is probably a dumb question, but how do I create a new group ID based on a string column in R? The values of the ID are arbitrary.
ID: the column I want to create
Name ID
A09john 1
J43mary 2
B7you 3
A09john 1
J43mary 2
B7you 3
I was hoping to use simple codes like below, but I don't know how to do it. Thank you!
df1 %>%
group_by(Name) %>%
mutate(ID = row_number(as.numeric(????)))