[Rd] Problem setting environment variable in R/zzz.R
Roger D. Peng
rpeng at jhsph.edu
Sat Jun 26 23:09:51 CEST 2004
The help page for Sys.putenv seems to indicate using a single "="
rather than the double "==". Could that be your problem?
-roger
Dirk Eddelbuettel wrote:
> I am trying to get the Rmetrics.org component package fBasics by Diethelm
> Wuertz into a Debian package. Thanks to a lot of work by Diethelm, it is
> _almost_ there. It fails 'R CMD check' for me if I do not have the TZ
> environment variable set [1], yet works fine as long as I set TZ.
>
> I figured I could patch this in R/zzz.R and do
>
> ## set a timezone if none found in environment variables or options()
> if (Sys.getenv("TZ")=="") {
> if (is.null(getOption("TZ"))) {
> cat("No timezone information found, using default of GMT\n")
> Sys.putenv("TZ"=="GMT")
> } else {
> cat("No timezone information found, applying option() value of",
> getOption("TZ"), "\n")
> Sys.putenv("TZ"==getOption("TZ"))
> }
> }
>
> right before library.dynam("fBasics", pkg, lib) concludes .First.lib().
>
> Now, even with that little patch, the R CMD check still fails. Which means
> that the package could fail CRAN tests unless CRAN has TZ set. That is a bit
> of a gamble I'd rather avoid.
>
> What am I doing wrong here?
>
> Thanks, Dirk
>
>
> [1] There is a bit of a Debian tradition to, if in doubt, cover things via
> a configuration file in /etc rather than an environment variable. I got
> rather used to that, and like living without env.vars.
>
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
More information about the R-devel
mailing list