[R] Re move row.names column in dataframe

Peter Ehlers ehlers at ucalgary.ca
Mon Mar 11 17:52:38 CET 2013


On 2013-03-11 06:07, Jorgen Harmse wrote:
> identical(df[1,],df[2,]) is FALSE because of the row names. all( == ) is just a work-around that I attempted.
>
> Jorgen.


I would just wrap the elements in c():

  identical( c(df[1,]), c(df[2,]) )

Peter Ehlers

>
> On Mar 11, 2013, at 02:53 , PIKAL Petr wrote:
>
>>>
>>>> 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
>>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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