[R] Creating .Rout.save files for package subdirectory "tests"

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Nov 5 12:22:50 CET 2004


On Fri, 5 Nov 2004, Arne Henningsen wrote:

> I added the "tests" subdirectory and a test file (say "myTest.R") to our 
> "systemfit" package. Up to now I create the "myTest.Rout.save" file with 
> > R CMD BATCH --vanilla myTest.R myTest.Rout.save
> 
> However, "R CMD check" reports two differences between myTest.Rout.save and 
> the output of myTest.R:
> a) myTest.Rout.save contains following extra line at the beginning of the 
> file:
> > invisible(options(echo = TRUE))
> b) myTest.Rout.save contains the following 2 extra lines at the very end of 
> the file:
> > proc.time()
> [1] 1.80 0.07 2.00 0.01 0.00
> 
> Everytime I change myTest.R and create a new myTest.R.save file I have to 
> delete these 3 lines by hand. I could do this e.g. by a script using "sed", 
> but I wonder if I can start "R CMD BATCH" with an option that suppresses any 
> commands that are not in the input file, i.e. "invisible(options(echo = 
> TRUE))" and "proc.time()".

This is not what R CMD BATCH is intended for, so on such option exists.

> Or what is the easiest way to create .Rout.save files?
> (I am using R 2.0.0 on a i686 PC with SuSE Linux 9.0)

1) Run R CMD check and copy myTest.Rout[.fail] to 
   pkg-name/tests/myTest.Rout.save.

2) R --vanilla < myTest.R > myTest.Rout.save 2>&1 if you use sh.
   R --vanilla < myTest.R >&! myTest.Rout.save    if you use csh

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list