[R-sig-Debian] pkg/tests: how to run them with --vanilla

Dirk Eddelbuettel edd at debian.org
Sun Jul 4 14:08:42 CEST 2010


On 4 July 2010 at 10:36, mat wrote:
| Thanks! But I have then a strange problem:
| -running R CMD BATCH will read in english
| -running R CMD BATCH --vanilla --slave will read in french!
| 
| I guess it comes from the fact that R CMD BATCH reads my .Rprofile 
| settings but --vanilla --slave not?

Yes, and by design as --vanilla means ignore my ~/.R* files.

So you must change your language in another place, for example in the shell
in which you are calling R CMD BATCH.  You could just create a 'worker
script' that sets those variables and then calls R CMD BATCH.

Dirk
 
| See:
| 
| mat at cunix:~/Dropbox/Documents/tsDyn/tsDyn/tests$ echo 
| "library(sandwich)" > foo.R
| mat at cunix:~/Dropbox/Documents/tsDyn/tsDyn/tests$ R CMD BATCH foo.R
| mat at cunix:~/Dropbox/Documents/tsDyn/tsDyn/tests$ cat foo.Rout
| 
| R version 2.11.1 (2010-05-31)
| [...]
| [Previously saved workspace restored]
| 
|  > library(sandwich)
| Loading required package: zoo
|  >
|  > proc.time()
| user system elapsed
| 0.630 0.010 0.632
| mat at cunix:~/Dropbox/Documents/tsDyn/tsDyn/tests$
| mat at cunix:~/Dropbox/Documents/tsDyn/tsDyn/tests$ R CMD BATCH --vanilla 
| --slave foo.R
| mat at cunix:~/Dropbox/Documents/tsDyn/tsDyn/tests$ cat foo.Rout
| Le chargement a nécessité le package : zoo
|  > proc.time()
| utilisateur système écoulé
| 0.38 0.02 0.38
| 
| So it seems I should change the language differently... probably setting 
| the global environment variable? I don't know if this is possible just 
| within the R CMD BATCH? I read from ?BATCH
| 
| Additional options can be set by the environment variable
| ‘R_BATCH_OPTIONS’: these come after ‘--restore --save
| --no-readline’ and before any options given on the command line
| 
| But I did not find any example how to run them...
| 
| Thanks!!
| 
| Matthieu
| 
| 
| 
| Le 03. 07. 10 23:13, Dirk Eddelbuettel a écrit :
| > On 3 July 2010 at 11:07, mat wrote:
| > | Hello
| > |
| > | I recently submitted an update of a package, and received error reports
| > | from CRAN maintainers concerning the pkg/tests section:
| > |
| > |>  Next time you update, can you please ensure that the .Rout.save files
| > |>  are generated in English (with LANGUAGE=en set).  R 2.12.x will ensure
| > |>  that the tests are run in English, and it saves a lot of unnecessary
| > |>  chatter if the reference results also are.
| > |>
| > |>  As a further point,
| > |>
| > |>>  [Sauvegarde de la session précédente restaurée]
| > |>
| > |>  indicates that they were not generated in a vanilla session, and they
| > |>  should be (as the tests are run with --vanilla --slave).
| > |>
| > |>  Brian Ripley
| > |   I always used to run the .Rout.save files with R CMD BATCH xxx.R So it
| > | seems I should rather do it with R --vanilla... I tried:
| > | cat xxx.R| R --vanilla --slave>  xxx.Rout.save
| >
| > See 'R CMD BATCH --help' --- you can pass further options along:
| >
| > edd at ron:/tmp$ echo "cat(4)">  foo.R
| > edd at ron:/tmp$ R CMD BATCH --vanilla --slave /tmp/foo.R
| > edd at ron:/tmp$ cat foo.Rout
| > 4>  proc.time()
| >     user  system elapsed
| >    0.352   0.036   0.373
| > edd at ron:/tmp$ R CMD BATCH --vanilla /tmp/foo.R
| > edd at ron:/tmp$ cat foo.Rout
| >
| > R version 2.11.1 (2010-05-31)
| > Copyright (C) 2010 The R Foundation for Statistical Computing
| > ISBN 3-900051-07-0
| >
| > R is free software and comes with ABSOLUTELY NO WARRANTY.
| > You are welcome to redistribute it under certain conditions.
| > Type 'license()' or 'licence()' for distribution details.
| >
| >    Natural language support but running in an English locale
| >
| > R is a collaborative project with many contributors.
| > Type 'contributors()' for more information and
| > 'citation()' on how to cite R or R packages in publications.
| >
| > Type 'demo()' for some demos, 'help()' for on-line help, or
| > 'help.start()' for an HTML browser interface to help.
| > Type 'q()' to quit R.
| >
| >    
| >> cat(4)
| >>      
| > 4>
| >    
| >> proc.time()
| >>      
| >     user  system elapsed
| >     0.34    0.04    0.38
| > edd at ron:/tmp$
| >
| > | But this gives files without the ">", and then it gets reported in the R
| > | CMD check... What would be the good way to do?
| > |
| > | Secondly, I always got this error that the R CMD BATCH run in french,
| > | but the R CMD check in english. I have been told I should change to
| > | language=EN. But how do I do this in Linux? I just added:
| > | Sys.setlocale("LC_ALL","en_US.UTF8")
| > | Sys.setlocale("LC_CTYPE","en_US.UTF8")
| > | Sys.setlocale("LC_MESSAGES","en_US.UTF8")
| > |
| > | in the .Rprofile... it this right?
| >
| > Defaults work for me, so I never changed them. Sorry.
| >
| >    
| 

-- 
  Regards, Dirk



More information about the R-SIG-Debian mailing list