Hi,
use ?unique
 unique(dat)
A.K.

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

______________________________________________
R-help@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.

Reply via email to