[R] Persistent storage between package invocations
Henrik Bengtsson
hb at biostat.ucsf.edu
Tue Mar 15 19:34:26 CET 2011
It would be nice to have a standard directory where R can write things
this way. A semi-standard directory is given by
Sys.getenv("R_LIBS_USER"), which defaults to ~/R/.../. Maybe ~/R/
could serve as that convention? That way we (various developers etc)
would also not clutter up users home directory in "random" ways.
Personally I prefer a hidden directory, e.g. ~/.R/, but there are pros
and cons with such an approach.
/Henrik
On Tue, Mar 15, 2011 at 8:57 AM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
> On Tue, 15 Mar 2011, Hadley Wickham wrote:
>
>> Hi all,
>>
>> Does anyone have any advice or experience storing package settings
>> between R runs? Can I rely on the user's home directory (e.g.
>> tools::file_path_as_absolute("~")) to be available and writeable
>> across platforms?
>
> No. First, please use path.expand("~") for this, and it does not
> necessarily mean the home directory (and in principle it might not expand at
> all). In practice I think it will always be *a* home directory, but on
> Windows there may be more than one (and watch out for local/roaming profile
> differences).
>
> Second, it need not be writeable, and so many package authors write rubbish
> in my home directory that I usually arrange it not be writeable to R test
> processes.
>
> If you want something writeable across processes, use dirname(tempdir()) .
>
>>
>> Hadley
>>
>> --
>> Assistant Professor / Dobelman Family Junior Chair
>> Department of Statistics / Rice University
>> http://had.co.nz/
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> --
> Brian D. Ripley, ripley at stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list