[Rd] Large discrepancies in the same object being saved to .RData

Terry Therneau therneau at mayo.edu
Mon Jul 12 15:44:21 CEST 2010


 I only wish to add a request for further documentation of hidden
environments, their consequences, and how to turn them off.  Perhaps a
page in the Extending R guide, and a suggestion for book authors.

  I was bitten by this with the coxph frailty functions.  They are
called during the model frame creation and create a matrix object with
various small attached functions as attributes.  In creating the 'x'
columns they have to deal with factors and can create a huge transient
temporary matrix while doing so; something that will never be needed
again.  A user was exceeding disk quotas when he saved a model fit.

  As someone with years of experience with functional languages (which S
once was), I wasn't used to the idea that one would have to take
explicit --- and mysterious --- steps to make local variables go away.
This discussion has revealed that the hidden rules causing local
variables to be kept are more complex than I thought.  Perhaps a "don't
save environments" option to save could be added to help mere mortals
get rid of all this stuff in the attic (with its secret staircase)?

[[Soapbox on]] Environments have proven useful for many things, and
certainly aren't going away.  But to quote the bard "Oh what tangled
webs we weave, when first we practice to decieve."

Terry Therneau



More information about the R-devel mailing list