Skip to content
Prev 61729 / 63421 Next

Correct use of tools::R_user_dir() in packages?

Thanks I?aki, that has been my experience as well.  But that is also
not how I read the current policy that Simon said.  First, my
understanding of the current policy is that in general, 'cleaning up'
is not consistent with the policy of not writing to home, hence my
suggestion of overriding the default locations by setting the env vars
R_USER_DATA_DIR etc to tmpdir() in testing mode.  Of course this could
be done globally on the CRAN testing machines, but I gather that is
not the case.   Second, having re-read the policy, it does seem to say
quite clearly that using R_user_dir() is an exception to the 'thou
shalt never write to $HOME' rule (provided you restrict to version
CRAN packages which tools::R_user_dir(), I would venture to say that
this policy and how it relates to the $HOME rule for
tests/examples/vignettes is maybe not as clear as it might be.
Unfortunately this rule does not seem to be covered by explicit code
in the `R CMD check` routine, so we cannot consult the source code to
get a more definitive answer about questions like whether clean-up or
use of temp files is or is not required by policy, though maybe this
is mostly my own confusion.  The examples in this thread have
definitely been helpful to me in understanding how others handle
persistent data/config/cache mechanisms.

Regards,

Carl


---
Carl Boettiger
http://carlboettiger.info/
On Thu, Jun 29, 2023 at 1:17?AM I?aki Ucar <iucar at fedoraproject.org> wrote: