[R] Startup on Windows 2000
Cliff Lunneborg
cliff at ms.washington.edu
Fri Oct 18 01:41:59 CEST 2002
I am having difficulty coming to grips with Appendix B.2 of the
otherwise very useful "An Introduction to R" and the related help file
for Startup. I am running RGui 1.6.0 on a Windows 2000 machine from the
default installation. How the concepts discussed in B.2 and the Startup
help file relate to what I see on my machine is something of a mystery.
I quote from the Startup file:
"In R, the startup mechanism is as follows.
Unless --no-environ was given, R searches for user and site files to
process for setting environment variables. The name of the site file is
the one pointed to by the environment variable R\_ENVIRON; if this is
unset, `$R_HOME/etc/Renviron.site' is used. The user files searched for
are `.Renviron' in the current or in the user's home directory (in that
order). See Details for how the files are read."
How can I tell if "--no-environ" was given? I cannot find either
Renviron.site or .Renviron on my system.
Then, Startup continues:
"Then R searches for the site-wide startup profile unless the command
line option --no-site-file was given. The name of this file is taken
from the value of the R\_PROFILE environment variable. If this variable
is unset, the default is `$R_HOME/etc/Rprofile.site'. This code is
loaded into package base."
Can I tell if "--no-site-file" was given? I don't find any object named
Rprofile.site on my machine.
Returning to Startup:
"Then, unless --no-init-file was given, R searches for a file called
`.Rprofile' in the current directory or in the user's home directory (in
that order) and sources it into the user workspace."
Was "--no.init.file" given in the default startup? I cannot find a file
.Rprofile anywhere.
Back to Startup:
"It then loads a saved image of the user workspace from `.RData' if
there
is one (unless --no-restore-data was specified, or --no-restore)."
Since R opens with a saved workspace, I'd guess "--no-restore-data" was
not specified.
"Finally, if a function .First exists, it is executed as .First()."
I located such a function in a Rprofile file. It appears to load the
ctest package.
"The functions .First and .Last can be defined in the appropriate
startup
profiles or reside in `.RData'."
What or where are these appropriate startup profiles? I located a
second Rprofile file in the \etc folder, but when I added a .First
function there it seemed to override the other .First function. Is that
intentional?
Later in the Startup help:
"Lines in a site or user environment file should be either comment lines
starting with #, or lines of the form name=value. The latter sets the
environmental variable name to value, overriding an existing value. If
value is of the form ${foo-bar}, the value is that of the environmental
variable foo if that exists and is set to a non-empty value, otherwise
bar. This construction can be nested, so bar can be of the same form (as
in ${foo-${bar-blah}})."
Are environment files the same as profile files?
Finally, towards the bottom of the Startup help:
"Examples
## Some examples with a Unix flavour
# ~/.Renviron
R_LIBS=~/R/library
PAGER=/usr/local/bin/less
# .Rprofile
options(width=65, digits=5)
options(show.signif.stars=FALSE)
ps.options(horizontal=FALSE)
set.seed(1234)
.First <- function() cat("\n Welcome to R!\n\n")
.Last <- function() cat("\n Goodbye!\n\n")
## if .Renviron contains
FOOBAR="coo\bar"doh\ex"abc\"def'"
## then we get
> cat(Sys.getenv("FOOBAR"), "\n")
coo\bardoh\exabc"def' "
What would some Windows examples look like?
I love R, and I would really like to learn something more about how it
is being customized for me and how I can (if I should) try to customize
it myself.
Clifford E. Lunneborg
Emeritus Professor, Statistics and Psychology
University of Washington, Seattle
Email: cliff at ms.washington.edu
Phone: 206 364 2013
Fax: 206 366 1078
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list