Re: [R] delete duplicated from data.frame

About this list Date view Thread view Subject view Author view Attachment view

From: Christian Schulz (ozric@web.de)
Date: Wed 19 May 2004 - 00:51:24 EST


Message-id: <200405181651.24489.ozric@web.de>

Uwe and Sundar,

many thanks and sorry for my confusion with indexes,values etc..
christian

Am Dienstag, 18. Mai 2004 16:39 schrieb Uwe Ligges:
> Christian Schulz wrote:
> > Hi,
> >
> > ?unique
> > unique returns a vector, data frame or array like x * but with duplicate
> > elements removed *
> >
> > what i'm doing wrong delete duplicated rows with same MEMEBRNO.
> >
> > februar <- dmsegment[unique(dmsegment$MEMBERNO),]
>
> unique() returns values, but not indices nor logicl values.
> Try instead:
>
> februar <- dmsegment[!duplicated(dmsegment$MEMBERNO),]
>
> Uwe Ligges
>
> > This reduce from 197.188 rows to 184.199 but duplicated MEMBERNO didn't
> > left all what a Primary Key setting in mysql me say and with a
> > fix(februar) could recognize .
> >
> > Courious why MEMEBRNO 4,5 ,6 and 11 are left !
> > dmsegment$MEMBERNO[1:10]
> > [1] 1 4 5 6 7 9 10 11 16 21
> >
> > februar$MEMBERNO[1:10]
> > [1] 1 6 7 9 10 16 21 26 53 72
> >
> > Using unique with a single vector it works like i expect.
> >
> >
> > P.S.
> > i try -duplcated but get not better succes?
> >
> > Many Thanks,
> > Christian
> >
> > ______________________________________________
> > R-help@stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:11 EST