[R] adding environment variables

2010-10-28 Thread Robert M. Flight
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.fli...@louisville.edu
EM rfligh...@gmail.com

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] adding environment variables

2010-10-28 Thread Henrique Dallazuanna
Take a look in ?Sys.setenv



On Thu, Oct 28, 2010 at 12:21 PM, Robert M. Flight rfligh...@gmail.comwrote:

 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.fli...@louisville.edu
 EM rfligh...@gmail.com

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

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.