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

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Mon May 14 16:38:33 CEST 2007


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



More information about the R-help mailing list