[R] filtering out duplicates & creating a dataframe with unique id

Bob Green bgreen at dyson.brisnet.org.au
Tue Apr 1 11:37:05 CEST 2008


Hello,

I am working on a dataframe that contains a number of duplicates (e.g 
a person may have more than one court appearance). There are 539 
rows. If I run the code:

 > length(unique(Feb25$ Patient.Id))

this indicates there are 508 unique individuals. I have been unable 
to work out how to filter out rows where there is a duplicate id so 
that the resulting dataframe consists only of the one id per person, 
and this id, is the first one thartappears.

I was also interested in creating a data frame that consisted of 
these removed duplicates.

  Any assistance with the code to do this is much appreciated,


regards

Bob Green



More information about the R-help mailing list