[R] Re move row.names column in dataframe

PIKAL Petr petr.pikal at precheza.cz
Mon Mar 11 08:53:13 CET 2013


Hi

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of jeharmse
> Sent: Friday, March 08, 2013 7:41 PM
> To: r-help at r-project.org
> Subject: Re: [R] Re move row.names column in dataframe
> 
> 
> ... the row.names will not interfere with any merging operation ...
> 
> Row names do not interfere with merge, but they cause other problems.
> In the example, I want to test whether rows have the same entries (in
> some or all columns). identical fails because of the row names, and
> all( == ) can fail if there are NAs. There are ways around this, but it
> would be cleaner to be able to remove row names.
> 
> > df <- data.frame(x=c(1,1,NA,NA), y=c(2,2,7,7))
> > identical(df[1,],df[2,])
> [1] FALSE
> > all(df[1,]==df[2,])
> [1] TRUE
> > all(df[3,]==df[4,])
> [1] NA

I beg your pardon, whot does row names do with the above result? What do you expect as a result of

all(df[3,]==df[4,])

Regards
Petr

> 
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Remove-row-
> names-column-in-dataframe-tp856647p4660743.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.



More information about the R-help mailing list