[R-pkg-devel] Proper way to ask a user to set permanent variables?

Rainer M Krug R@|ner @end|ng |rom krug@@de
Fri Jan 17 09:01:14 CET 2020


Hi Dirk,

The package-local environment is definitely a good approach (I use it myself an a few packages). And the options() are nice as they represent a standardised interface in R (Note to myself: I should use these more in my packages).

But unless I am missing something, these are not persistent between sessions? I assume, that is not an issue in your case?

Cheers,

Rainer
 

> On 15 Jan 2020, at 23:47, Dirk Eddelbuettel <edd using debian.org> wrote:
> 
> 
> Jonathan,
> 
> In all but one (maybe two?) of my packages I found relying on options()
> sufficient. I usually follow the somewhat-common pattern of creating a
> package-local environment in R/init.R or R/zzz.R. I then fill it with values
> reflecting options() (often under a tag starting with the package name)
> and/or environment variables, and sometime also provide 'setters' to update
> the environment values. That have proven to be both good enough and rather
> robust and, as an added benefit, does not depend on anything further.
> 
> Cheers, Dirk
> 
> -- 
> http://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
> 
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Orcid ID: 0000-0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Zürich
Office Y34-J-74
Winterthurerstrasse 190
8075 Zürich
Switzerland

Office:	+41 (0)44 635 47 64
Cell:       	+41 (0)78 630 66 57
email:      Rainer.Krug using uzh.ch
		Rainer using krugs.de
Skype:     RMkrug

PGP: 0x0F52F982




	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list