[R] all.equal and names?

Spencer Graves spencer.graves at pdf.com
Wed Aug 18 18:02:02 CEST 2004


Hi, Duncan: 

      Thanks much.  I think I remember reading about both "all.equal" 
and "identical" in Venables and Ripley (2002) MASS.  Unfortunately, I 
don't have MASS handy now, and I could not find it otherwise, so I asked. 

      What needs to happen to upgrade the "all.equal" documentation to 
add "identical" to the "see also"? 

      Best Wishes,
      Spencer

Duncan Murdoch wrote:

>On Wed, 18 Aug 2004 10:27:49 -0400, Spencer Graves
><spencer.graves at pdf.com> wrote :
>
>  
>
>>     How can I compare two objects for structure, names, values, etc.?  
>>With R 1.9.1 under Windows 2000, the obvious choice "all.equal" ignores 
>>names and compares only values: 
>>
>>    
>>
>>>all.equal(1, c(a=1))
>>>      
>>>
>>[1] TRUE
>>
>>     Under S-Plus 6.2, I get the comparison I expected: 
>>
>>    
>>
>>>all.equal(1, c(a = 1))
>>>      
>>>
>>[1] "target, current classes differ: integer : 
>>named"                                                   
>>[2] "class of target is \"integer\", class of current is \"named\" 
>>(coercing current to class of target)"
>>    
>>
>
>If you want the explanation you're out of luck, but identical() does
>the test:
>
>  
>
>>identical(1, c(a = 1))
>>    
>>
>[1] FALSE
>
>Duncan Murdoch
>  
>




More information about the R-help mailing list