Re: [R] dataframe

From: jim holtman <jholtman_at_gmail.com>
Date: Tue, 25 Nov 2008 08:17:38 -0500

Does this do it for you:

> x <- read.table(textConnection("abc 123 345

+ abc 345 456
+ lmn 567  345
+ hkl 568 535
+ lmn 096  456
+ lmn 768 094"))

>
> x

   V1 V2 V3
1 abc 123 345
2 abc 345 456
3 lmn 567 345
4 hkl 568 535
5 lmn 96 456
6 lmn 768 94
> x[!duplicated(x$V1),]

   V1 V2 V3
1 abc 123 345
3 lmn 567 345
4 hkl 568 535

On Mon, Nov 24, 2008 at 11:30 PM, Rajasekaramya <ramya.victory_at_gmail.com> wrote:
>
> 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
>
> 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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

______________________________________________
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.
Received on Tue 25 Nov 2008 - 13:20:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 25 Nov 2008 - 14:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive