<[EMAIL PROTECTED]>
Subject: Re: [R] Unique.data.frame...still getting duplicates
Date: Fri, 25 Jun 2004 12:45:26 +1000
data[!duplicated(data$ID),]
will do. Your unique(data[ID,]) removes duplicated rows in data[ID,],
assuming the object ID exists.
Alec Stephenson
Department of Statist
Your code cannot possibly work in a recent version of R, so please try the
current version (1.9.1).
data[ID, ] is what? Why not just call unique() on ID?
BTW, if you call methods such as unique.data.frame you are adding possible
course of error -- here I suspect data[ID, ] is not what you inten
data[!duplicated(data$ID),]
will do. Your unique(data[ID,]) removes duplicated rows in data[ID,],
assuming the object ID exists.
Alec Stephenson
Department of Statistics
Macquarie University
NSW 2109, Australia
>>> "F Z" <[EMAIL PROTECTED]> 06/25
> From: F Z
>
> Hi there
>
> I have a data frame with about 65,000 rows and 8 variables.
> I am trying to
> get rid of the double entries of a factor variable "ID" so I
> can get a
> unique observation for each ID
>
> I tried:
>
> >dupl_unique.data.frame(data[ID,]) #I obtain a data frame w
Hi there
I have a data frame with about 65,000 rows and 8 variables. I am trying to
get rid of the double entries of a factor variable "ID" so I can get a
unique observation for each ID
I tried:
dupl_unique.data.frame(data[ID,]) #I obtain a data frame with 21,547
observations..so far so good,