Re: [R] Appropriate method for sharing data across functions

2012-04-09 Thread John C Nash
Thanks to Hadley, William and Duncan for suggestions. I'm currently implementing a solution that is close to that of William and Duncan (and learning more about environments in the process). I suspect the reference classes are possibly a more reliable long term solution. I'll plead laziness unt

Re: [R] Appropriate method for sharing data across functions

2012-04-09 Thread Duncan Murdoch
On 05/04/2012 4:20 PM, John C Nash wrote: In trying to streamline various optimization functions, I would like to have a scratch pad of working data that is shared across a number of functions. These can be called from different levels within some wrapper functions for maximum likelihood and ot

Re: [R] Appropriate method for sharing data across functions

2012-04-09 Thread Hadley Wickham
> Make OPCON an environment and pass it into the functions that may read it or > alter it.  There > is no real need to pass it out, since environments are changed in-place > (unlike lists).  E.g., >  > x <- list2env(list(one=1, two="ii", three=3)) >  > x >   >  > objects(x) >  [1] "one"   "three"

Re: [R] Appropriate method for sharing data across functions

2012-04-05 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of John C Nash > Sent: Thursday, April 05, 2012 1:20 PM > To: r-help@r-project.org > Subject: [R] Appropriate method for sharing data across functions > > In trying to streamline

Re: [R] Appropriate method for sharing data across functions

2012-04-05 Thread Hadley Wickham
Why not pass around a reference class? Hadley On Thu, Apr 5, 2012 at 3:20 PM, John C Nash wrote: > In trying to streamline various optimization functions, I would like to have > a scratch pad of working data that is shared across a number of functions. > These can be called from different levels