[R] dataframe without repetition

Chuck Cleland ccleland at optonline.net
Wed Nov 9 15:05:16 CET 2005


?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




More information about the R-help mailing list