Solution: Available environment variables
Thank you Duncan (additional comments below),
-----Original Message----- From: Duncan Murdoch [mailto:murdoch at stats.uwo.ca] Sent: December 20, 2007 02:36 PM To: Thompson, David (MNR) Cc: r-help at r-project.org Subject: Re: [R] Available environment variables On 20/12/2007 2:13 PM, Thompson, David (MNR) wrote:
Hello,
I am trying to set my environment to streamline the downloading /
updating of packages. I have been through R-intro.html (10.8
Customizing-the-environment), R-FAQ (5.2 How can add-on packages be
installed?), rw-FAQ, and help pages for Sys.setenv {base},
download.packages {utils}, etc.,.
I am looking for something similar to the download.packages destdir
argument on a global environment level, e.g., destdir <- 'C:/Program
Files/_dave/stats/R/library/_download' in Rprofile.site. Any
suggestions?
You could create your own function: download.packages <- function(pkgs, destdir='C:/Program Files/_dave/stats/R/library/_download', ...) utils::download.packages(pkgs, destdir, ...)
Also, in a more general context, is there a way of listing all
available
(or common, or default, or standard, . . .) environment variables?
Sys.getenv() will return a list of the ones that are currently defined.
I would like to know if there is an existing convention for any
arbitrary
process that I may try to do without reinventing the wheel. This same question could apply to options() other than those included with a standard installation.
I don't know what you mean about an "arbitrary process". For options(), you could save the names that you consider standard
(e.g.
by starting an empty session and entering standardoptions <- names(options()), then at a later time do newoptions <- names(options()) newoptions[ !(newoptions %in% standardoptions) ] There's no easy way to know the options that would mean something in
the
current context but are not currently defined. Duncan Murdoch
Creating a local copy of the function with alternate argument defaults
works perfectly. I have done that in the past, don't know why I didn't
think of it this time. Thank you.
Saving initial- and post-session options (or their names) also nicely
addresses part of my concern. Thank you.
I am familiar with Sys.getenv() and was asking about potential
environment variables that are NOT currently defined. However, while
trying to rephrase my question, having reread the Startup {base} help
and related documentation, could not clearly refine the issue in my own
mind so, I am now content with the situation.
I think that I may be confusing the intended use of environment files
and profile files as noted in the details section of the Startup {base}
documentation. Part of my concern is to find a way of safeguarding
against my own errors and typos that may 'break the system' or having
something installed later (the "arbitrary process" part) breaking my
current setup. Also, I may be thinking of the startup process as
something 'different' from the interactive R session processing, which I
am beginning to see it is not.
Thanks again, DaveT.
*************************************
Silviculture Data Analyst
Ontario Forest Research Institute
Ontario Ministry of Natural Resources
david.john.thompson at ontario.ca
http://ofri.mnr.gov.on.ca