Re: [R] Persistent storage between package invocations

2011-03-18 Thread Martin Maechler

> 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.

{ this becomes more and more a topic for R-devel ...
  where the thread really should have been  started  (!) }

I agree that it would be nice...
*iff* it can be provided in a  platform-agnostic way.
I'm not enough of a Mac or Windows user to be in a position to
answer that with a view towards all the possibilities R is used.

WRT to ~/.R/ and ~/R/  I agree with your preference of using
~/.R/  as that has *already* been used for other configuration
settings, and it seems awkward to have both side by side.

Martin


> /Henrik


> On Tue, Mar 15, 2011 at 8:57 AM, Prof Brian Ripley
>  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@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,                  rip...@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@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.
>

__
R-help@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.

__
R-help@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.


Re: [R] Persistent storage between package invocations

2011-03-18 Thread Henrik Bengtsson
On Wed, Mar 16, 2011 at 6:00 AM, Hadley Wickham  wrote:
>> 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).
>
> Ok - I did remember that something like path.expand existed, I just
> couldn't find it.  (And I always get confused by the difference
> between normalizePath and path.expand).
>
>> 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.
>
> So at a minimum I need to check if the "home" directory is writeable,
> and fail gracefully if not.
>
> What about using the registry on windows?  Does R provide any
> convenience functions for adding/accessing entries?
>
>> If you want something writeable across processes, use dirname(tempdir()) .
>
> I was really looking for options to be persistent between instances -
> i.e. so you decide once, and not need to be asked again. In a similar
> way, it would be nice if you could choose a CRAN mirror once and then
> not be asked again - and not need to know anything about how to set
> options during startup.

To add more of my noise:

When you want to define "persistent package settings" you also have to
consider which should be "user specific" and which should be
"project/directory specific" (we also have "site-wide" settings shared
by many users and session-only settings).  For instance, we have
.Rprofile and .Renviron that are/can be user specific, whereas
.Rhistory and .RData often being considered to be project specific,
which in practice means stored in the current directory.  Some
settings can easily be identified to be one or the other, but some are
more in the grey zone.  For those, should the project specific
settings override the user specific ones?  How and where should you
store them so that you it is clear how to separate and so on.   These
are questions that have held me back on finding a solution for
persistent settings.  For instance, I've been thinking of having
options() to be automatically (and immediately) stored persistently,
but where, how and when/when not?  ...not to talk about how to handle
race conditions if you run multiple sessions.

My $.02

/Henrik

>
> Hadley
>
> --
> Assistant Professor / Dobelman Family Junior Chair
> Department of Statistics / Rice University
> http://had.co.nz/
>
> __
> R-help@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.
>

__
R-help@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.


Re: [R] Persistent storage between package invocations

2011-03-16 Thread Hadley Wickham
> 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).

Ok - I did remember that something like path.expand existed, I just
couldn't find it.  (And I always get confused by the difference
between normalizePath and path.expand).

> 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.

So at a minimum I need to check if the "home" directory is writeable,
and fail gracefully if not.

What about using the registry on windows?  Does R provide any
convenience functions for adding/accessing entries?

> If you want something writeable across processes, use dirname(tempdir()) .

I was really looking for options to be persistent between instances -
i.e. so you decide once, and not need to be asked again. In a similar
way, it would be nice if you could choose a CRAN mirror once and then
not be asked again - and not need to know anything about how to set
options during startup.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

__
R-help@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.


Re: [R] Persistent storage between package invocations

2011-03-15 Thread Henrik Bengtsson
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
 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@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,                  rip...@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@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.
>

__
R-help@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.


Re: [R] Persistent storage between package invocations

2011-03-15 Thread Prof Brian Ripley

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@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,  rip...@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, UKFax:  +44 1865 272595

__
R-help@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.


[R] Persistent storage between package invocations

2011-03-15 Thread Hadley Wickham
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?

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

__
R-help@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.