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

Zhian Kamvar zk@mv@r @end|ng |rom gm@||@com
Fri Jan 17 10:49:09 CET 2020


Options are not persistent between sessions unless the user wants them to
be. You can have users set the options in their .Rprofile either in the
working directory of the project or their home directory. This is the
method that the {usethis} package has for storing default names. The only
downside to this is that any R scripts associated will not be reproducible
unless paired with the .Rprofile file.

Best,
Zhian

On Fri, Jan 17, 2020 at 8:01 AM Rainer M Krug <Rainer using krugs.de> wrote:

> 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]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list