[R] Remove duplicate rows based on condition
arun
smartpink111 at yahoo.com
Fri Feb 7 17:58:11 CET 2014
Hi,
If I understand it correctly, you could use ?unique() or ?duplicated()
unique(mydf)
#or
mydf[!duplicated(mydf),]
A.K.
Hello everyone. I am very new to R and very bad in programming.
I need to remove some rows based on multiple conditions.
For example, I have this table:
Id = c(1,1,2,2,3,3)
url = c("a", "b", "a", "a", "b","b")
mydf = data.frame(Id,url)
I want to remove the second row of url of the same Id, but keep both rows of
url if they are different.
Thank you very much.
More information about the R-help
mailing list