John C Nash
2012-May-15 14:16 UTC
[Rd] How to set up an object to share data across diverse functions
In the past 6 months I've been struggling with an issue that has been raised periodically on the lists. This is the need to share information across a group of functions, possibly from different packages. So far I've found solutions that are either quite clumsy or else don't work as have (likely incorrectly) read the manuals. I'll be writing up my experiences as a way to help others, but am wondering if there is an accepted way to establish an object that can be read and written by a number of functions. I'm currently using list2env to create a list under the "umbrella" function, and if necessary pass this to other functions by name through the dot arguments, though preferably I'd rather use a pre-arranged and fixed name (this does not seem to work unless the object is in the global environment, and then I've occasionally had locked bindings errors, which I'll freely admit I don't understand at all). I also have to be very careful with dot arguments, especially if they are matrices. I've a couple of examples, but they are pretty long, so I'll save for off-list transmission. JN