Douglas Bates
2003-Jul-28 19:22 UTC
[Rd] Recommended way to change defaultPackages under Windows
What is the recommended way to change the default set of packages that are loaded at startup by R for Windows? I am writing vignettes for the Devore6 package which my introductory engineering statistics students will use and I would like to describe how the R environment can be changed so that this package is loaded by default. I understand from the R for Windows FAQ that one way would be to install a Rprofile or Rprofile.site file containing options(defaultPackages = c(options("defaultPackages"), "Devore6")) Would this be the recommended way?
Prof Brian Ripley
2003-Jul-28 20:00 UTC
[Rd] Recommended way to change defaultPackages under Windows
On 28 Jul 2003, Douglas Bates wrote:> What is the recommended way to change the default set of packages that > are loaded at startup by R for Windows? I am writing vignettes for > the Devore6 package which my introductory engineering statistics > students will use and I would like to describe how the R environment > can be changed so that this package is loaded by default. > > I understand from the R for Windows FAQ that one way would be to > install a Rprofile or Rprofile.site file containing > > options(defaultPackages = c(options("defaultPackages"), "Devore6")) > > Would this be the recommended way?Yes, except that using Rprofile.site (can be called Rprofile) needs write access to the R installation (or setting an environment file R_PROFILE), and otherwise it is .Rprofile. -- Brian D. Ripley, ripley@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
Uwe Ligges
2003-Jul-28 20:11 UTC
[Rd] Recommended way to change defaultPackages under Windows
Douglas Bates wrote:> What is the recommended way to change the default set of packages that > are loaded at startup by R for Windows? I am writing vignettes for > the Devore6 package which my introductory engineering statistics > students will use and I would like to describe how the R environment > can be changed so that this package is loaded by default. > > I understand from the R for Windows FAQ that one way would be to > install a Rprofile or Rprofile.site file containing > > options(defaultPackages = c(options("defaultPackages"), "Devore6")) > > Would this be the recommended way?Right (or use an environment variable). ?options tells us: "defaultPackages: the packages that are attached by default when R starts up. Initially set from value of the environment variables R_DefaultPackages, or if that is unset to c("methods", "ctest"). (Set R_DEFAULT_PACKAGES to NULL or a comma-separated list of package names.) A call to options should be in your `.Rprofile' file to ensure that the change takes effect before the base package is initialized (see Startup)." But the user's .Rprofile might be more appropriate for students who don't have access to R's /etc directory likes in our department's configuration. BTW: Is ?options completely correct? I have [1] "ts" "nls" "modreg" "mva" "ctest" "methods" in my list of defaultPackages, not only "methods" and "ctest". Looks like an update is required. (talking about R-1.7.1 unpatched) Uwe
David Brahm
2003-Jul-29 19:16 UTC
[Rd] Recommended way to change defaultPackages under Windows
Douglas Bates <bates@stat.wisc.edu> wrote:> options(defaultPackages = c(options("defaultPackages"), "Devore6"))Just to pick a nit, shouldn't this be: options(defaultPackages = c(getOption("defaultPackages"), "Devore6")) since options("defaultPackages") returns a one-component list, not a vector? -- -- David Brahm (brahm@alum.mit.edu)