Re: [R] Problem with R CMD BATCH on R-2.5.0 due to Sys.unsetenv not available

From: Peter Dalgaard <P.Dalgaard_at_biostat.ku.dk>
Date: Mon, 14 May 2007 16:38:33 +0200

Simon Penel wrote:
> Hello,
>
> I am working on an unix SunOS machine ( sun4u sparc) and since the last
> release of R -R version 2.5.0 (2007-04-23) - ,
> I have got troubles during the execution of batch command.
>
>
> For example with the instruction file multic.in
> >cat multic.in
> install.packages("multic","/bge/penel/R_install/R_2.5.0/lib/R/library",repos="http://cran.at.r-project.org")
>
>
> When I use the BATCH command, I get an error :
>
> >R_2.5.0/bin/R CMD BATCH multic.in
>
> creates the multic.in.Rout file :
>
> >cat multic.in.Rout
> Error in Sys.unsetenv("R_BATCH") : 'Sys.unsetenv' is not available on
> this system
> Execution halted
>
>
> Effectiveley, Sys.unsetenv is not available on unix
> When running R :
> > Sys.unsetenv("toto")
> Error in Sys.unsetenv("toto") : 'Sys.unsetenv' is not available on this
> system
>
>
> Does that mean that it is not possible anymore to use R CMD BATCH on
> unix OS ?
>
Hmm, if so, nobody did the platform testing sufficiently well...

The code in question seems to be at the end of

src/library/profile/Common.R

which ends up in the system-wide

library/base/R/Rprofile


if(Sys.getenv("R_BATCH") != "") {

    .Last.sys <- function()
    {

        cat("> proc.time()\n")
        print(proc.time())

    }
    ## avoid passing on to spawned R processes     Sys.unsetenv("R_BATCH")
}

> This is very recent, since it was working fine with the R-patched
> version :R version 2.5.0 Under development (unstable) (2007-03-18 r40854)
>
>
>
Yes, svn praise has this:

 40621     ripley if(Sys.getenv("R_BATCH") != "") {
 40621     ripley     .Last.sys <- function()
 40621     ripley     {
 40621     ripley         cat("> proc.time()\n")
 40621     ripley         print(proc.time())
 40621     ripley     }
 40972     ripley     ## avoid passing on to spawned R processes
 40972     ripley     Sys.unsetenv("R_BATCH")
 40621     ripley }

Does Sys.setenv work? If so, you might replace the offending line by

Sys.setenv("")

(or remove it entirely and avoid spawning R processes....)

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-help_at_stat.math.ethz.ch 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 Mon 14 May 2007 - 14:52:27 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 Mon 14 May 2007 - 17:31:33 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.