[Rd] R Startup configuration file

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed Feb 10 16:06:26 CET 2010

On Wed, Feb 10, 2010 at 11:44 AM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:

> When I read the ?Startup man page, I find it is too complicated already; I
> don't want to add another kind of file to read.  (Would we have  separate
> user and site versions of this new file?  When would it be handled?)
> However, we could achieve what you are asking for with no changes to base R.
>  One way would be to write a small package to handle options.  When you want
> to save a setting, you call a function there that writes it to a private
> file.  Then you manually add a line to your .Rprofile, saying something like
> "myOptionPackage::loadMyOptions()".  This can do whatever you want, it only
> needs to know how to parse the file that your package wrote.

 Yup, I'd already thought about this. However it does mean that any
other packages or applications that use this feature are going to have
to say "make sure you have saveableOptions::loadMyOptions() in your R
profile startup somewhere". Resulting in "huh what?" from users.

 Actually that's not true if the options are only used in add-on
packages - they can require(saveableIOptions) and load them in their
package .First.lib or .onLoad code. It's only options in the R base
(set by options()) that you need to hack code in order to run at

 In most modern programs, options and setup state are stored when the
user hits the 'apply' button. Even emacs can handle customisation in a
set of config files these days. Can't remember the last time I hacked
lisp in my .emacs file.

 But I agree that writing a saveable options package is the first step
- then making that a default in R is the second so people don't have
to edit profiles and R packages and applications can expect an API for
savable state.

 As for Startup Overload Syndrome - yes, ?Startup is a bit complicated
already. Maybe a sign it needs simplifying!


More information about the R-devel mailing list