[R] unique rows

array chip
Tue, 28 Jan 2014 22:06:01 -0000

Hi, I wanted to remove redundant rows (with same entry in columns) in a data
frame. For example, with this data frame:

>
dat<-cbind(x=c('a','a','b','b','c','c'),y=c('x','x','d','s','g','g'))
> dat
     x   y
[1,] "a" "x"
[2,] "a" "x"
[3,] "b" "d"
[4,] "b" "s"
[5,] "c" "g"
[6,] "c" "g"

after removing the redundancy, the end results should be

     x   y
[1,] "a" "x"
[2,] "b" "d"
[3,] "b" "s"
[4,] "c" "g"

what is the best way to do this?

Thanks

John
	[[alternative HTML version deleted]]