Re: [Rd] Options that are local to the package that sets them

2014-10-31 Thread Gábor Csárdi
On Fri, Oct 31, 2014 at 9:26 PM, Martin Morgan wrote: [...] > You'll need pkgA to be able to know that pkgB1's invokation is to use > pkgB1's parameters, so coupling state (parameters) with function, i.e., a > class with methods. So a solution is to use an S4 or reference class and > generator to

Re: [Rd] Options that are local to the package that sets them

2014-10-31 Thread Gábor Csárdi
On Fri, Oct 31, 2014 at 9:20 PM, Gabor Grothendieck wrote: [...] > Isn't your problem really just that you want multiple sets of > settings? That's what settings provides. Almost. Multiple sets of settings, set up by the same package. So essentially I want pkgA to use different settings when cal

Re: [Rd] Options that are local to the package that sets them

2014-10-31 Thread Martin Morgan
On 10/31/2014 05:55 PM, Gábor Csárdi wrote: On Fri, Oct 31, 2014 at 8:16 PM, William Dunlap wrote: You can put the following 3 objects, an environment and 2 functions that access it, in any package that need some package-specific storage (say your pkgB1 and pkgB2). .pkgLocalStorage <- new.e

Re: [Rd] Options that are local to the package that sets them

2014-10-31 Thread Gabor Grothendieck
On Fri, Oct 31, 2014 at 8:43 PM, Gábor Csárdi wrote: > On Fri, Oct 31, 2014 at 8:10 PM, Gabor Grothendieck > wrote: > [...] >>> Is there a better way? I have a feeling that this is already supported >>> somehow, I just can't find out how. >>> >> >> Try the settings package. > > I could, but I don

Re: [Rd] Options that are local to the package that sets them

2014-10-31 Thread Gábor Csárdi
On Fri, Oct 31, 2014 at 8:16 PM, William Dunlap wrote: > You can put the following 3 objects, an environment and 2 functions > that access it, in any package that need some package-specific > storage (say your pkgB1 and pkgB2). >.pkgLocalStorage <- new.env(parent = emptyenv()) >assignInPkg

Re: [Rd] Options that are local to the package that sets them

2014-10-31 Thread Gábor Csárdi
On Fri, Oct 31, 2014 at 8:10 PM, Gabor Grothendieck wrote: [...] >> Is there a better way? I have a feeling that this is already supported >> somehow, I just can't find out how. >> > > Try the settings package. I could, but I don't see how it would solve my problem. https://github.com/markvanderl

Re: [Rd] Options that are local to the package that sets them

2014-10-31 Thread William Dunlap
You can put the following 3 objects, an environment and 2 functions that access it, in any package that need some package-specific storage (say your pkgB1 and pkgB2). .pkgLocalStorage <- new.env(parent = emptyenv()) assignInPkgLocalStorage <- function(name, object) { .pkgLocalStorage[[

Re: [Rd] Options that are local to the package that sets them

2014-10-31 Thread Gabor Grothendieck
On Fri, Oct 31, 2014 at 7:34 PM, Gábor Csárdi wrote: > Dear All, > > I am trying to do the following, and could use some hints. > > Suppose I have a package called pkgA. pkgA exposes an API that > includes setting some options, e.g. pkgA works with color palettes, > and the user of the package can

[Rd] Options that are local to the package that sets them

2014-10-31 Thread Gábor Csárdi
Dear All, I am trying to do the following, and could use some hints. Suppose I have a package called pkgA. pkgA exposes an API that includes setting some options, e.g. pkgA works with color palettes, and the user of the package can define new palettes. pkgA provides an API to manipulate these pal