[R] remove duplicates in data frame

arun smartpink111 at yahoo.com
Mon Apr 8 22:34:15 CEST 2013


Hi,
Try ?unique()
You haven't provided reproducible data or information about the package.  So, this may or may not work.

dat1<- data.frame(idvar=c(rep(1,2),2,4),col2=c(7,7,8,9))
 dat1
#  idvar col2
#1     1    7
#2     1    7
#3     2    8
#4     4    9
 unique(dat1)
#  idvar col2
#1     1    7
#3     2    8
#4     4    9
A.K.




I got the following message when trying to use Google motion charts. 

Error in gvisCheckMotionChartData(data, my.options) : 
  The data must have rows with unique combinations of idvar and timevar. 
Your data has 16264 rows, but idvar and timevar only define 16262 unique rows. 
> 

How do I find and remove the two duplicate rows? 

Thanks, 
Johnny



More information about the R-help mailing list