Winston Chang
2014-Oct-29 20:26 UTC
[Rd] Unexpected behavior of identical() with language objects
I ran into this and found the result very surprising: identical( quote({ a }), quote({ a }) ) # FALSE It seems related to curly braces. For example, parens work fine: identical( quote(( a )), quote(( a )) ) # TRUE Is this expected behavior? I can't seem to find anything in the help for identical that relates to this. -Winston
Joshua Ulrich
2014-Oct-29 20:37 UTC
[Rd] Unexpected behavior of identical() with language objects
On Wed, Oct 29, 2014 at 3:26 PM, Winston Chang <winstonchang1 at gmail.com> wrote:> I ran into this and found the result very surprising: > > identical( quote({ a }), quote({ a }) ) > # FALSE > > It seems related to curly braces. For example, parens work fine: > identical( quote(( a )), quote(( a )) ) > # TRUE > > Is this expected behavior? I can't seem to find anything in the help > for identical that relates to this. >It's not in ?identical, but ?Paren gives you some pointers. str(quote((a))) and str(quote({a})) are also informative.> -Winston > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel-- Joshua Ulrich | about.me/joshuaulrich FOSS Trading | www.fosstrading.com
Lorenz, David
2014-Oct-29 20:44 UTC
[Rd] Unexpected behavior of identical() with language objects
Fascinating! I tried the comparisons with all.equal(), expecting a description of the difference, but TRUE was returned in both cases. Dave On Wed, Oct 29, 2014 at 3:26 PM, Winston Chang <winstonchang1 at gmail.com> wrote:> I ran into this and found the result very surprising: > > identical( quote({ a }), quote({ a }) ) > # FALSE > > It seems related to curly braces. For example, parens work fine: > identical( quote(( a )), quote(( a )) ) > # TRUE > > Is this expected behavior? I can't seem to find anything in the help > for identical that relates to this. > > -Winston > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >[[alternative HTML version deleted]]