[R] Sys.getenv at startup is not working properly
oliver at first.in-berlin.de
Sat Apr 30 21:18:53 CEST 2011
Sys.getenv() during startup-phase (.First or .Rprofile)
to get the env-variables
COLUMNS as well as HOST I get empty strings.
After the startup is done, when asking via Sys.getenv()
by hand, COLUMNS is set (but HOST is not, even "hostname" on the shell gives me
a correct answer).
At the moment my problem is the missing COLUMNS value during start up,
because I want to set the linewidth for printing via
automatically at startup.
$ R CMD BATCH myscript.R
the same problem occurs, but then at least I can understand
the case (but interpreting "" as "0" by the options() would be better,
because the option-setting would then not break the script; it does break the
script, when COLUMNS is "").
(btw: Is there a possibility to decide if the script is running in batch mode or
interactively? This could be a workaround for "" not interpreted as "0".)
The setting with the options/Sys.getenv() works, when typed in by hand
after startup is completed, as well as when sourcing-in a script that
contains such a options/Sys.getenv-command.
here is, what R.version contains:
system x86_64, linux-gnu
svn rev 50720
version.string R version 2.10.1 (2009-12-14)
Is this problem fixed in newer releases?
Or if not: how can I inform the R developers, so that they can
pick it up?
(Some R developers might be on this list?!)
More information about the R-help