[R-pkg-devel] Writing to users config directory for CRAN package
Dirk Eddelbuettel
edd @end|ng |rom deb|@n@org
Sat Nov 5 21:29:20 CET 2022
On 5 November 2022 at 19:32, David Hugh-Jones wrote:
| I'm considering submitting the package onetime (
| https://github.com/hughjonesd/onetime/) to CRAN.
|
| Onetime has functions for showing a message or warning only once (ever per
| user). It does this by writing to a file in the user's configuration
| directory, as reported by rappdirs::user_config_dir().
There is a base R function tools::R_user_dir() which I use in a few packages
along with packageName() to store config information across sessions. A quick
search at GitHub's 'cran' org mirroring CRAN finds 110 hits:
https://github.com/search?q=org%3Acran+R_user_dir&type=code
You could keep a hashmap in that directory, and maybe (before it has been
written a first time) alert the user that you cannot write without (initial)
permission. As I recall, the idea behind the (sensible) CRAN Policy is to
not litter user directories with random files with the user knowing.
Dirk
--
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
More information about the R-package-devel
mailing list