Skip to content
Prev 367112 / 398506 Next

Help with saving user defined functions

Jeff:

Oh yes!-- and I meant to say so and forgot, so I'm glad you did. Not
only might the free variable in the function not be there; worse yet,
it might be there but something else. So it seems like a disaster
waiting to happen. The solution, I would presume, is to have no free
variables (make them arguments). Or save and read the function *and*
its environment.  Namespaces in packages I think would also take care
of this, right?

Note: If my understanding on any of this is incorrect, I would greatly
appreciate someone settting me straight. In particular, as Jeff noted,
my understanding is that saving a function (closure)  with a free
variable in the function depends on the function finding its enclosing
environment when it is read back into R via readRDS() .  Correct?  The
man page is silent on this point.

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sun, Feb 12, 2017 at 4:26 PM, Jeff Newmiller
<jdnewmil at dcn.davis.ca.us> wrote: