I am using R in ubuntu. The environment variable value returned is wrong. I had the environment variable set to a value. After a disk crash, I changed its value. However the R will always return the old value. I don't know where R cached the old value and insists on returning the old value.
The environment variable's new value
echo $WFDATA
/current/environment/value
Start a new R terminal
R
> Sys.getenv('WFDATA')
[1] "/old/environment/value"
Now try to set the environment variable to the new value
> Sys.setenv(WFDATA='/current/environment/value')
> Sys.getenv('WFDATA')
[1] "/current/environment/value"
> q()
Save workspace image? [y/n/c]: y
Start a new R terminal and you still get the old value
> Sys.getenv('WFDATA')
[1] "/old/environment/value"
>
Not sure why R is so stubborn as to remember the old value. Any one can suggest a way to fix this problem? This problem appears in both the R session and in the Rscript file.