[R] Remove duplicate rows based on condition

arun
Fri, 07 Feb 2014 16:58:11 -0000

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.