[R] Comparing serialized language objects

Tim Taylor t|m@t@y|or @end|ng |rom h|ddene|eph@nt@@co@uk
Thu Nov 20 15:01:09 CET 2025


Is there a correct way to compare language objects that may have been serialized?
If I run the following in an interactive, but 'vanilla' R, session:

x <- quote(\(){})
y <- serialize(x, NULL)
z <- unserialize(y)
identical(x, z)

Then the resulting answer is FALSE. But I get TRUE if run as

$ R --vanilla -s -e "x <- quote(\(){})
y <- serialize(x, NULL)
z <- unserialize(y)
identical(x, z)"
[1] TRUE

Is this where I need to start thinking about the refhook argument?

Any help appreciated.

Tim



More information about the R-help mailing list