[R] R_LIBS difficulty ?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Apr 15 08:34:55 CEST 2005
On Thu, 14 Apr 2005, François Pinard wrote:
> [Prof Brian Ripley]
>> [François Pinard]
>
>>> Now using this line within `~/.Renviron':
>>> R_LIBS=/home/pinard/etc/R
>>> my tiny package is correctly found by R. However, R does not seem to
>>> see any library within that directory if I rather use either of:
>>> R_LIBS=$HOME/etc/R
>>> R_LIBS="$HOME/etc/R"
>
>> Correct, and as documented. See the description in ?Startup,
>> which says things like ${foo-bar} are allowed but not $HOME, and
>> not ${HOME}/bah or even ${HOME}. But R_LIBS=~/etc/R will work in
>> .Renviron since ~ is intepreted by R in paths.
>
> Hello, Brian (or should I rather write Prof Ripley?).
>
> Thanks for having replied. I was not sure how to read "but not", which
> could be associated either with "which says" or "are allowed". My
> English knowledge is not fully solid, and I initially read you meant the
> later, but it seems the former association is probably the correct one.
It does not say. You have gone beyond what it says is allowed.
>
> The fact is the documentation never says that `$HOME' or `${HOME} are
> forbidden. It is rather silent on the subject, except maybe for this
> sentence: "value is processed in a similar way to a Unix shell" in the
> Details section, which vaguely but undoubtedly suggests that `$HOME' and
> `${HOME}' might be allowed. Using `~/' is not especially documented
> either, except from the Examples section, where it is used. I probably
> thought it was an example of how shell-alike R processes `~/.Renviron'.
Yes, it is silent. And silence means it is not documented to work.
>>> The last writing (I mean, something similar) is suggested somewhere in
>>> the R manuals (but I do not have the manual with me right now to give
>>> the exact reference, I'm in another town).
>
>> It is not mentioned in an R manual, but it is mentioned in the FAQ.
>
> I tried checking in the FAQ. By the way, http://www.r-project.org
> presents a menu on the left, and there is a group of items under the
> title `Documentation'. `FAQs' is shown under that title, but is not
> clickable. I would presume it was meant to be? However, the `Other'
> item is itself clickable, and offers a link to what appears to be an
> FAQs page.
>
> The only thing I saw, in item 5.2 of the FAQ (How can add-on packages be
> installed?) says that one may use `$HOME/' while defining `R_LIBS' in a
> Bourne shell profile, or _preferably_ use `~/` while defining `R_LIBS'
> within file `~/.Renviron`. The FAQ does not really say that `$HOME' is
> forbidden. The FAQ then refers to `?Startup' for more information, and
> `?Startup' is not clear on this thing, in my opinion at least.
>
>> R_LIBS=$HOME/etc/R will work in a shell (and R_LIBS=~/etc/R may not).
>
>>> Another hint that it could be expected to work is that the same
>>> `~/.Renviron' once contained the line:
>
>>> R_BROWSER=$HOME/bin/links
>
>>> which apparently worked as expected. (This `links' script launches
>>> the real program with `-g' appended whenever `DISPLAY' is defined.)
>
>> Yes, but that was not interpreted by R, rather a shell script called by R.
>
> Granted, thanks for pointing this out.
>
> The documentation does not really say either (or else I missed it) if
> the value of R_BROWSER is given to exec, or given to an exec'ed shell.
> If a shell is called, it means in particular that we can use options,
> and this is a useful feature, worth being known I guess.
It is platform-dependent, and indeed may change over time on a given
platform.
The trick in reading technical documentation is to read what it says, and
not assume what it does not say.
--
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
More information about the R-help
mailing list