I use below to create a list of AuthorId:
df.Author <- tibble::rowid_to_column(data.frame(df.Author,"AuthorId"))
However I want to make the dupilcation as a same id.
I want to change the AuthorId in dataframe. Like all Mazumdar's AuthorId is 3.
What should I do? The reason why I didn't delete the duplication is that there are other attribute in this table are not the same. Just names are duplicating, so I want them to have a same ID.
We may need match
nm1 <- with(df.Author, paste(LastName, FirstName))
df.Author$AuthorId <- match(nm1, unique(nm1))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.