RFC: Loading packages at startup

(Ted Harding) Ted.Harding@nessie.mcc.ac.uk
Tue, 22 Oct 2002 09:34:49 +0100 (BST)

On 21-Oct-02 Prof Brian D Ripley wrote:
> [...]
> Proposal:
> Extend the initialization as described in Startup.Rd by having
> optionally files named, say, R_HOME/etc/Rpackages.site and .Rpackages,
> the latter in the starting directory or failing that the user's home
> directory. Each would contain a list of packages, one per line, to be
> loaded when R is started, in the order in the files.

This would certainly be useful, especially (as in (4) below) when
resuming an analysis session.

> Some details:
> [...]
> 4) One problem with saving an R session and then restoring it is that
>    the packages in use are not reloaded.  Quitting an R session and
>    saving could write .Rpackages in the current directory (with the
>    library recorded if it were not the default).  Then restarting a
>    session in that directory would restore the loaded packages
>    automatically.

A comment from a practical user's viewpoint. I'm not sure of the value
of having this happen automatically. In practice I have a directory for
a dataset, only occasionally different sub-directories for different
analyses, and several different analyses might be done on that dataset.

If the above (4) were implemented as it stands, everything that was ever
loaded would be reloaded each time (if I understand right). It would be
better, perhaps, to allow flexibility (unless the overhead etc. of
loading un-needed packages could be ignored), and I can see two ways:

a) Offer a choice at startup between different ".Rpackages.XXX" where
"XXX" varies with the job and is mnemonic for the user (i.e. the user
chose it in the first place). I think this would also require the
implementation to query the user at quit time about what ".Rpackages.XXX"
should be called.

b) (More complicated and trickier to implement, more transparent
perhaps for the user, but maybe demanding too much foresight in
the implementation) the ".Rpackages" or equivalent would keep track in
some way of dependencies, so that if the user invoked a function which
had been used in a previous session, packages needed would be loaded

Best wishes to all,

E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 22-Oct-02                                       Time: 09:34:49
------------------------------ XFMail ------------------------------
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch