Skip to content
Prev 62231 / 63424 Next

Bug in comparison of language objects?

On 20/02/2024 8:03 a.m., Duncan Murdoch wrote:
I have done some debugging, and found the cause:  for the comparison of 
language objects, R deparses them to strings using C function 
deparse1(), and looks at only the first line.  "mean(a)" deparses as is, 
but "{ a }" deparses to 3 lines

{
   a
}

and the first line is the same as for "{ b }", so they compare equal.

I think it would make more sense to deparse them to one long string, and 
compare those, i.e. to replace deparse1() with deparse1line() (which may 
have been the intention).

Duncan Murdoch