[R] Re move row.names column in dataframe

Berend Hasselman bhh at xs4all.nl
Sun Jun 22 07:45:24 CEST 2008




tonyxv wrote:
> 
> 
> Hello,
> 
> aa<-c(1,1,2,2,3,3,4,4,5,5,6,6)
> bb<-c(56,56,33,33,53,53,20,20,63,63,9,9) 
> cc<-data.frame(aa,bb) 
> uniquedf <- unique(cc)
> View(uniquedf)
> 
> 
> Why does the column "row.names" appear in the new dataframe and how do I
> get rid of it.
> 
> "uniquedf$row.names <- NULL" does not seem to work.
> 
> For what I'm doing this is a useless column and can cause confusion and/or
> problems for subsequent merging/filtering etc.
> 
> 
> Thanks.
> 

There is no column row.names; there are only row names.

In R enter

?unique
?View
?row.names
?data.frame

and your questions will  be answered.

To get sequential row numbers you can do

row.names(uniquedf) <- NULL


Berend
-- 
View this message in context: http://www.nabble.com/Remove-row.names-column-in-dataframe-tp18050179p18051448.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list