David Kane <David Kane
2001-Jun-04 13:59 UTC
[R] Problems with environmental variables set with Sys.putenv
Hi, I see some weird behavior when loading a specific dataframe after changing the value of an enviroment variable using Sys.putenv(). Alas, I can't reproduce it from an arbitrary dataframe. Here is the session: R : Copyright 2001, The R Development Core Team Version 1.2.3 (2001-04-26) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type `license()' or `licence()' for distribution details. R is a collaborative project with many contributors. Type `contributors()' for more information. Type `demo()' for some demos, `help()' for on-line help, or `help.start()' for a HTML browser interface to help. Type `q()' to quit R. [Previously saved workspace restored]> Sys.getenv("MODE")MODE "PRODUCTION"> ls()character(0)> load("~/data/latest/R/Factors.Rdata") > ls()[1] "Factors"> Sys.getenv("MODE")MODE "PRODUCTION" ################## So far, so good. Loading a dataframe shouldn't, I think, effect the setting of an environment variable under any (?) circumstances. Just to be sure, I load it a couple more times. #################> load("/home/a296180/data/latest/R/Factors.Rdata") > Sys.getenv("MODE")MODE "PRODUCTION"> load("/home/a296180/data/latest/R/Factors.Rdata") > Sys.getenv("MODE")MODE "PRODUCTION" ################# Now I change the setting of the environment variable, and load the dataframe again. Everything is fine, but when I load it a second time, the value of $MODE gets set to missing! ################> Sys.putenv("MODE"="TEST") > Sys.getenv("MODE")MODE "TEST"> load("/home/a296180/data/latest/R/Factors.Rdata") > Sys.getenv("MODE")MODE "TEST"> load("/home/a296180/data/latest/R/Factors.Rdata") > Sys.getenv("MODE")MODE "" ################# At this point, I am stumped. As I mentioned, I have been unable to make this occur with an arbitrary dataframe. With most (AFAIK all) of my other dataframe, this does not occur. If there was interest, I would be happy to submit this as a bug report and/or pass along the offending dataframe. But, my first thought is that I am missing something . . . Thanks for any help, Dave Kane -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._