[Rd] Correct use of tools::R_user_dir() in packages?
Carl Boettiger
cboett|g @end|ng |rom gm@||@com
Thu Jun 29 01:33:53 CEST 2023
Thanks Simon, I was very much hoping that would be the case! It may
be that I just need to put the version requirement on 4.0 then. I
will be sure to add this version restriction to my packages (which
technically I should be doing anyway since this function didn't exist
in early versions of `tools`.)
Cheers,
Carl
---
Carl Boettiger
http://carlboettiger.info/
On Wed, Jun 28, 2023 at 12:59 PM Simon Urbanek
<simon.urbanek using r-project.org> wrote:
>
> Carl,
>
> I think your statement is false, the whole point of R_user_dir() is for packages to have a well-defined location that is allowed - from CRAN policy:
>
> "For R version 4.0 or later (hence a version dependency is required or only conditional use is possible), packages may store user-specific data, configuration and cache files in their respective user directories obtained from tools::R_user_dir(), provided that by default sizes are kept as small as possible and the contents are actively managed (including removing outdated material)."
>
> Cheers,
> Simon
>
>
> > On 28/06/2023, at 10:36 AM, Carl Boettiger <cboettig using gmail.com> wrote:
> >
> > tools::R_user_dir() provides configurable directories for R packages
> > to write persistent information consistent with standard best
> > practices relative to each supported operating systems for
> > applications to store data, config, and cache information
> > respectively. These standard best practices include writing to
> > directories in the users home filespace, which is also specifically
> > against CRAN policy.
> >
> > These defaults can be overridden by setting the environmental
> > variables R_USER_DATA_DIR , R_USER_CONFIG_DIR, R_USER_CACHE_DIR,
> > respectively.
> >
> > If R developers should be using the locations provided by
> > tools::R_user_dir() in packages, why does CRAN's check procedure not
> > set these three environmental variables to CRAN compliant location by
> > default (e.g. tempdir())?
> >
> > In order to comply with CRAN policy, a package developer can obviously
> > set these environmental variables themselves within the call for every
> > example, every unit test, and every vignette. Is this the recommended
> > approach or is there a better technique?
> >
> > Thanks for any clarification!
> >
> > Regards,
> >
> > Carl
> >
> > ---
> > Carl Boettiger
> > http://carlboettiger.info/
> >
> > ______________________________________________
> > R-devel using r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
>
More information about the R-devel
mailing list