Re: [R] Sys.getenv at startup is not working properly

From: Duncan Murdoch <murdoch.duncan_at_gmail.com>
Date: Sun, 01 May 2011 07:42:23 -0400

Please upgrade to a current release (or R-patched). Version 2.10.1 is quite old.

Duncan Murdoch

On 30/04/11 3:18 PM, Oliver wrote:
> Hello,
>
> when using
>
> 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
>
> options(width=Sys.getenv("COLUMNS"))
>
> automatically at startup.
>
> When using
> $ 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:
> ==============================================
> _
> platform x86_64-pc-linux-gnu
> arch x86_64
> os linux-gnu
> system x86_64, linux-gnu
> status
> major 2
> minor 10.1
> year 2009
> month 12
> day 14
> svn rev 50720
> language R
> 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?!)
>
> Ciao,
> Oliver
>
> ______________________________________________
> R-help_at_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.



R-help_at_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. Received on Thu 05 May 2011 - 06:25:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 05 May 2011 - 07:00:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive