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

Gabor Grothendieck ggrothendieck at gmail.com
Sat Nov 1 02:20:29 CET 2014


On Fri, Oct 31, 2014 at 8:43 PM, Gábor Csárdi <csardi.gabor at gmail.com> wrote:
> On Fri, Oct 31, 2014 at 8:10 PM, Gabor Grothendieck
> <ggrothendieck at gmail.com> 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/markvanderloo/settings/issues/1

Isn't your problem really just that you want multiple sets of
settings?  That's what settings provides.

pkgA would provide a class whose instances are created by the clients.
Assuming you wrap this in a function create:

inst1 <- create(a = 1, b = 2)

where create sets up a settings object and does anything else
returning the handle inst1.

When you want to do something you would pass the instance to the
function or method that actually carries it out.  This could be done
with any OO system in R without settings but if you are looking for an
options type interface which I thought you were then you might be able
to leverage that package.




-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-devel mailing list