[R] R and Scheme

Duncan Murdoch murdoch at stats.uwo.ca
Wed Dec 10 10:40:13 CET 2008

[deletions, including attribution, which I think were Stavros then Luke 
then Peter:]

>>> In R, most data types (including numeric vectors) do not have a standard
>>> external representation which can be read back in without evaluation.
>> The default print form is not readable in this sense but dput is
>> available for this purpose.
> I think the point is that dput() is not always equivalent to the object 
> - parsing dput output gives a different object from the original. 
> Numeric vectors of length > 1 is the most obvious case, "expression" 
> objects another (those can get terribly confusing at times).

I would have thought the save() format (possibly with ascii=TRUE) was 
the standard external representation.  I believe your examples and 1.0/3 
both survive save()/load().

Or does "standard external representation" imply that the parser can 
reconstruct the object?  If so, there would be other things besides 
.const that would be needed.  In particular, environments and the more 
exotic types like promises and external pointers aren't deparsed in a 
parsable way.  Environments and promises do survive save/load, but I 
don't think there's any way external pointers could.

Duncan Murdoch

More information about the R-help mailing list