[R] Odp: dataframe

Petr PIKAL petr.pikal at precheza.cz
Thu Nov 27 13:09:17 CET 2008


Hi

r-help-bounces at r-project.org napsal dne 25.11.2008 05:30:52:

> 
>  hi there
> 
> I have a dataframe
> 
> abc 123 345
> abc 345 456
> lmn 567  345
> hkl 568 535
> lmn 096  456
> lmn 768 094
> 
> i want the uniques of column 1 and there corresponsing column 2 and 3
> output
> abc 123 345
> lmn 567  345
> hkl 568 535
> 
> cbind(DF1[,1],DF1[which(unique(DF1[,1]),c(2,3)])
> but didnt work

If test is your data frame

test[match(unique(test$V1),test$V1),]

shall selecte first unique items.

Regards
Petr

P.S. Not necessary to post your question several times.

> 
> kindly let me know how to go abt it
> 
> ramya
> -- 
> View this message in context: 
http://www.nabble.com/dataframe-tp20675022p20675022.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list