[Rd] Recommended way to change defaultPackages under Windows

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Jul 28 21:11:45 MEST 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?

Right (or use an environment variable). ?options tells us:

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 

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)


More information about the R-devel mailing list