[R] Customization options with .Renviron, R_LIBS, .Rprofile etc

ravi rv15i at yahoo.se
Tue Jul 21 21:56:34 CEST 2009


Hi,
I am interested in customizing the installation of R. I have
gone through the “R Installation and Administration” manual. But some
of the stuff is not clear to me and I would like to get clarifications
on the following points (for a Windows installation with
R_HOME=C:\\R\\R-2.9.1 ) :
1.  I understand that I need to create a
file, .Renviron with the following path : R_HOME\\etc\\.Renviron where
a number of environmental variables can be set. I would first like to
know if the file to be created is Renviron or .Renviron. Both versions
are mentioned in the manual. By the way, many functions in R start with
a period. Is there any special significance to a name (file, function
etc) if it starts with a period?
2.  I want to have two different
libraries – one for the packages that follow with the R installation
and a second one for any additional packages that I add afterwards. By
doing this, I hope to avoid repeating the installation of these packages
once again after an update of R. I understand that I can set the paths
to these libraries with the environmental variables R_LIBS or
R_LIBS_USER in the .Renviron file. But I am not entirely sure about the
difference between these two environmental variables. It is mentioned
in the manual that multiple paths (for different libraries) can be
specified. Does this mean that I can set the paths with any of these
environmental variables? Or, should I set R_LIBS=R_HOME\\library and
R_LIBS_USER to my private library? Does this also mean that any package that
I add with the install.packages() function will then end up in the
private library?
3.  If I want to start R with a certain set of
packages loaded on startup, I understand that I need to create a file
.Rprofile with the path R_HOME\\etc\\.Rprofile. Again, should it be
.Rprofile or Rprofile (or, is it Rprofile.site which I see is already
present in my R installation)? Is the following syntax OK for
specifying the environmental variable 
R_DEFAULT_PACKAGES = {“base”, “datasets”,”utils”,”ggplot2”,“lattice”}
How can I add, for example, ggplot2 and lattice to the list of default packages that R normally starts with?
4. 
If I add a .Renviron file to my working directory, will it override
that in R_HOME? Or, is it the other way around? Can I add a .Rprofile
file as well to the working directory where I can specify the
R_DEFAULT_PACKAGES a little differently?
Thanking you,
Ravi




More information about the R-help mailing list