Hello,
with a data.frame like this :
> toto <-
data.frame(id=c("id1","id1","id2","id3","id3","id3"),dpt=c("13","13","34","30","30","30"))
> toto
id dpt
1 id1 13
2 id1 13
3 id2 34
4 id3 30
5 id3 30
6 id3 30
what is the most efficient ways to obtain :
id dpt
1 id1 13
2 id2 34
3 id3 30
?
thanks in advance for your reply
Bruno
Si vous n'etes pas destinataires de ce message, merci d'avertir
l'expediteur de l'erreur de distribution et de le detruire
immediatement.
Ce message contient des informations confidentielles ou appartenant a La
Francaise des Jeux. Il est etabli a l'intention exclusive de ses
destinataires. Toute divulgation, utilisation, diffusion ou reproduction (totale
ou partielle) de ce message ou des informations qu'il contient, doit etre
prealablement autorisee.
Tout message electronique est susceptible d'alteration et son integrite ne
peut etre assuree. La Francaise des Jeux decline toute responsabilite au titre
de ce message s'il a ete modifie ou falsifie.
If you are not the intended recipient of this e-mail, please notify the sender
of the wrong delivery and delete it immediately from your system.
This e-mail contains confidential information or information belonging to La
Francaise des Jeux and is intended solely for the addressees. The unauthorised
disclosure, use, dissemination or copying (either whole or partial) of this
e-mail, or any information it contains, is prohibited.
E-mails are susceptible to alteration and their integrity cannot be guaranteed.
La Francaise des Jeux shall not be liable for this e-mail if modified or
falsified.
?unique
> unique(toto)
id dpt
1 id1 13
3 id2 34
4 id3 30
Bruno Cutayar wrote:>
> Hello,
> with a data.frame like this :
> > toto <-
>
data.frame(id=c("id1","id1","id2","id3","id3","id3"),dpt=c("13","13","34","30","30","30"))
> > toto
> id dpt
> 1 id1 13
> 2 id1 13
> 3 id2 34
> 4 id3 30
> 5 id3 30
> 6 id3 30
>
> what is the most efficient ways to obtain :
> id dpt
> 1 id1 13
> 2 id2 34
> 3 id3 30
> ?
> thanks in advance for your reply
> Bruno
>
>
>
> Si vous n'etes pas destinataires de ce message, merci d'avertir
l'expediteur de l'erreur de distribution et de le detruire
immediatement.
> Ce message contient des informations confidentielles ou appartenant a La
Francaise des Jeux. Il est etabli a l'intention exclusive de ses
destinataires. Toute divulgation, utilisation, diffusion ou reproduction (totale
ou partielle) de ce message ou des informations qu'il contient, doit etre
prealablement autorisee.
> Tout message electronique est susceptible d'alteration et son integrite
ne peut etre assuree. La Francaise des Jeux decline toute responsabilite au
titre de ce message s'il a ete modifie ou falsifie.
>
> If you are not the intended recipient of this e-mail, please notify the
sender of the wrong delivery and delete it immediately from your system.
> This e-mail contains confidential information or information belonging to
La Francaise des Jeux and is intended solely for the addressees. The
unauthorised disclosure, use, dissemination or copying (either whole or partial)
of this e-mail, or any information it contains, is prohibited.
> E-mails are susceptible to alteration and their integrity cannot be
guaranteed. La Francaise des Jeux shall not be liable for this e-mail if
modified or falsified.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>
--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894
> toto[!duplicated(apply(toto,1,paste, collapse='.')),]id dpt 1 id1 13 3 id2 34 4 id3 30 On 11/9/05, Bruno Cutayar <bcutayar@lfdj.com> wrote:> > > > Hello, > with a data.frame like this : > > toto <- > data.frame > (id=c("id1","id1","id2","id3","id3","id3"),dpt=c("13","13","34","30","30","30")) > > toto > id dpt > 1 id1 13 > 2 id1 13 > 3 id2 34 > 4 id3 30 > 5 id3 30 > 6 id3 30 > > what is the most efficient ways to obtain : > id dpt > 1 id1 13 > 2 id2 34 > 3 id3 30 > ? > thanks in advance for your reply > Bruno > > > > Si vous n'etes pas destinataires de ce message, merci d'avertir > l'expediteur de l'erreur de distribution et de le detruire immediatement. > Ce message contient des informations confidentielles ou appartenant a La > Francaise des Jeux. Il est etabli a l'intention exclusive de ses > destinataires. Toute divulgation, utilisation, diffusion ou reproduction > (totale ou partielle) de ce message ou des informations qu'il contient, doit > etre prealablement autorisee. > Tout message electronique est susceptible d'alteration et son integrite ne > peut etre assuree. La Francaise des Jeux decline toute responsabilite au > titre de ce message s'il a ete modifie ou falsifie. > > If you are not the intended recipient of this e-mail, please notify the > sender of the wrong delivery and delete it immediately from your system. > This e-mail contains confidential information or information belonging to > La Francaise des Jeux and is intended solely for the addressees. The > unauthorised disclosure, use, dissemination or copying (either whole or > partial) of this e-mail, or any information it contains, is prohibited. > E-mails are susceptible to alteration and their integrity cannot be > guaranteed. La Francaise des Jeux shall not be liable for this e-mail if > modified or falsified. > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >-- Jim Holtman Cincinnati, OH +1 513 247 0281 What the problem you are trying to solve? [[alternative HTML version deleted]]
unique(): see its help page. (It has a data-frame method.) On Wed, 9 Nov 2005, Bruno Cutayar wrote:> > > Hello, > with a data.frame like this : > > toto <- > data.frame(id=c("id1","id1","id2","id3","id3","id3"),dpt=c("13","13","34","30","30","30")) > > toto > id dpt > 1 id1 13 > 2 id1 13 > 3 id2 34 > 4 id3 30 > 5 id3 30 > 6 id3 30 > > what is the most efficient ways to obtain : > id dpt > 1 id1 13 > 2 id2 34 > 3 id3 30 > ? > thanks in advance for your reply > Bruno-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595