From therneau at mayo.edu  Mon Jul 12 15:44:21 2010
From: therneau at mayo.edu (Terry Therneau)
Date: Mon, 12 Jul 2010 08:44:21 -0500
Subject: [Rd] Large discrepancies in the same object being saved to
	.RData
In-Reply-To: <mailman.17.1278928806.10324.r-devel@r-project.org>
References: <mailman.17.1278928806.10324.r-devel@r-project.org>
Message-ID: <1278942261.12038.23.camel@punchbuggy>

 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



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