Re: [R] Available environment variables

From: Duncan Murdoch <>
Date: Thu, 20 Dec 2007 14:36:14 -0500

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 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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 20 Dec 2007 - 19:45:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 21 Dec 2007 - 16:30:20 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.