[R] adding environment variables

Robert M. Flight rflight79 at gmail.com
Thu Oct 28 16:21:51 CEST 2010


Hi All,

I am developing a package that requires information about the location
of a set of files that will be used often in the calculations. In my
current version, I define the location in the main file that calls all
the subfunctions. This works fine when you are installing from source,
but will not work so well if I want people to be able to install
binary versions of the package. Therefore, I think the best way to
encode the information would be through the use of an environment
variable, that could then be read by "Sys.getenv(VARIABLE)" when the
function is called.

In the help, I found a few different ways to set environment
variables, but the easiest way (from my reading anyways) seemed to be
by creating the file "Renviron.site" in the R_HOME/etc directory and
adding the variable there. I am interested in opinions from the list,
or other suggestions on how to do this.

For those who are interested, the package does a lot of parsing of
KEGG KGML files, and to speed up calculations I offer advice that they
should download a copy of the KGML directory for their organism to
their local machine, and I want the package to know where those files
are at runtime.

Thanks in advance,

-Robert

Robert M. Flight, Ph.D.
University of Louisville Bioinformatics Laboratory
University of Louisville
Louisville, KY

PH 502-852-0467
EM robert.flight at louisville.edu
EM rflight79 at gmail.com

Williams and Holland's Law:
       If enough data is collected, anything may be proven by
statistical methods.



More information about the R-help mailing list