Skip to content

Creating .Rout.save files for package subdirectory "tests"

4 messages · Martin Maechler, Brian Ripley, Arne Henningsen

#
Hi,

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
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:
b) myTest.Rout.save contains the following 2 extra lines at the very end of 
the file:
[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()".
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)

Thanks,
Arne
#
Arne> Hi, I added the "tests" subdirectory and a test file
    Arne> (say "myTest.R") to our "systemfit" package. Up to now
    Arne> I create the "myTest.Rout.save" file with
    >> R CMD BATCH --vanilla myTest.R myTest.Rout.save

that explains everything.  
Why do you do so?

Instead: 

1) Start with no '.Rout.save'

2) R CMD check  <pkg>
   will produce one in  <pkg>.Rcheck/tests/myTest.Rout
   Copy it to the package source, i.e. typically

   cp <pkg>.Rcheck/tests/myTest.Rout <pkg>/tests/myTest.Rout.save

3) R CMD check  <pkg>  
   now *will* do the comparison and give no difference hopefully

Martin Maechler, ETH Zurich


    Arne> However, "R CMD check" reports two differences between
    Arne> myTest.Rout.save and the output of myTest.R: a)
    Arne> myTest.Rout.save contains following extra line at the
    Arne> beginning of the file:
    >> invisible(options(echo = TRUE))
    Arne> b) myTest.Rout.save contains the following 2 extra
    Arne> lines at the very end of the file:
    >> proc.time()
    Arne> [1] 1.80 0.07 2.00 0.01 0.00

    Arne> Everytime I change myTest.R and create a new
    Arne> myTest.R.save file I have to delete these 3 lines by
    Arne> hand. I could do this e.g. by a script using "sed",
    Arne> but I wonder if I can start "R CMD BATCH" with an
    Arne> option that suppresses any commands that are not in
    Arne> the input file, i.e. "invisible(options(echo = TRUE))"
    Arne> and "proc.time()".  Or what is the easiest way to
    Arne> create .Rout.save files?  (I am using R 2.0.0 on a
    Arne> i686 PC with SuSE Linux 9.0)

    Arne> Thanks, Arne
#
On Fri, 5 Nov 2004, Arne Henningsen wrote:

            
This is not what R CMD BATCH is intended for, so on such option exists.
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
#
Thank you, Martin and Prof. Ripley, for your very helpful answers! 
It would be nice if this could be mentioned in section 1.1.4 of the "Writing R 
Extensions" manual. 
Arne
On Friday 05 November 2004 12:17, Martin Maechler wrote: