[Rd] wishlist: Clarify how to auto-load libraries at R start-up (PR#14224)
jgibson at hhcorp.org
jgibson at hhcorp.org
Wed Feb 24 19:30:15 CET 2010
Full_Name: Joe Gibson
Version: 2.9.2
OS: Windows
Submission from: (NULL) (12.229.76.26)
I am new to R. Setting up R for my epidemiology department, I want users to
have access to ggplot2 functions without having to remember to load that library
before using the functions. It was very challenging to find how to do that.
This will help others who wish to make R easy to use for less tech-y
colleagues:
1) In the "Note" section of library() function help
[R_home\library\base\html\library.html], add something like this:
To have libraries loaded by default when R is launched, add this code to the
R_HOME/etc/Rprofile.site file
local({
old <- getOption("defaultPackages")
options(defaultPackages = c(old, "ggplot2"))
})
To find the R_HOME folder, use
Sys.getenv("R_home")
(I only know that this works in Windows. I adapted that code from
http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html )
2) Just before 6.3.1 in
http://cran.r-project.org/doc/manuals/R-admin.html#Managing-libraries , add a
paragraph saying: "NOTE: The functions in an installed add-on package are not
available until the package is loaded. See the library() function help for more
information."
More information about the R-devel
mailing list