From brian at braverock.com  Wed Sep  3 23:16:11 2014
From: brian at braverock.com (Brian G. Peterson)
Date: Wed, 03 Sep 2014 16:16:11 -0500
Subject: [Rd] timings for examples in R CMD check
In-Reply-To: <CAAHES9zN07jPXFGa2ezTEC=Vq0U_Vb+3d7_mqXa2fm4CGu3j0A@mail.gmail.com>
References: <540772CC.3070108@braverock.com>
	<CAAHES9zN07jPXFGa2ezTEC=Vq0U_Vb+3d7_mqXa2fm4CGu3j0A@mail.gmail.com>
Message-ID: <5407851B.6070108@braverock.com>

Gavin,

You were correct.  Operator error.

My tests/Examples directory contained both a

   ?PerformanceAnalytics-Ex.Rout? and a
   ?PerformanceAnalytics-Ex.Rout.save?

file.

Corrected now, and check shows

* checking examples ... OK

Thanks for the help.

Brian

On 09/03/2014 03:36 PM, Gavin Simpson wrote:
> Brian,
>
> What you are doing is how I have always checked my packages:
>
> 1. Run R CMD check pkg_tarball.tar.gz
> 2. mv pkg.Rcheck/pkg-Ex.Rout pkg_sources/tests/Examples/pkg-Ex.Rout.save
> 3. Next R CMD check pkg_tarball.tar.gz checks against the new Example output
>
> Are you sure you are getting the newly created pkg-Ex.Rout file and
> placing it in the correct part of the package and adjusting the name
> to pkg-Ex.Rout.save?
>
> The only time I ever had a problem with this was when I inadvertently
> used a .Rout file from a check with --as-cran.
>
> G
>
>
> On 3 September 2014 13:58, Brian G. Peterson <brian at braverock.com
> <mailto:brian at braverock.com>> wrote:
>
>     I'm having a very hard time making R CMD check produce a clean check
>     on examples because of the timings inserted into examples by R CMD
>     check.
>
>     I am getting a difference on every example output caused by timing
>     information being inserted by 'R CMD check'.
>
>     The current 'Writing R Extensions' manual[1] states on p. 14:
>
>         If directory tests has a subdirectory Examples containing a
>         file pkg-Ex.Rout.save, this is  compared to the output file
>         for running the examples when the latter are checked.
>         Reference  output should be produced without having the
>         --timings option set (and note that --as-cran  sets it).
>
>     As is suggested above, if I run
>
>         R CMD check --as-cran mypkg.tar.gz
>
>     or
>
>         R CMD check --timings mypkg.tar.gz
>
>     the my.pkg.Rcheck/mypkg-Ex.Rout file contains timing lines inserted
>     by 'R CMD check'
>
>     If, instead, I follow my reading of the manual, and run
>
>     R CMD check mypkg.tar.gz
>
>     the mypkg.Rcheck/mypkg-Ex.Rout file does not contain timings.  If I
>     then copy the mypkg.Rcheck/mypkg-Ex.Rout file to
>
>     mypkg/tests/Examples/mypkg-Ex.__Rout.save
>
>     as described by footnote 17 on the previously referenced p. 14, I
>     would expect to now have no differences, as demonstrated by 'diff'
>     or 'diff -bw' as used by 'R CMD check'.
>
>     To my surprise, whether I copy a version of the mypkg-Ex.Rout file
>     with or without timing rows, I get differences reported for every
>     example by the (spurious?) insertion of timings by R CMD check.
>
>     e.g.
>     8169a8549,8550
>      > > base::assign(".dptime", (proc.time() - get(".ptime", pos =
>     "CheckExEnv")), pos = "CheckExEnv")
>      > > base::cat("textplot", base::get(".format_ptime", pos =
>     'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n",
>     file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t")
>     8175a8557
>
>
>
>     Is this expected?
>
>     It is certainly not the behavior we had for many years, where a
>     check of examples could actually be clean, producing differences
>     only on the 'Time elapsed:' line, which has been present for many R
>     versions.  I have tried testing against a package with both the
>     timing lines includes and excluded in /mypkg-Ex.Rout.save, and with
>     R CMD check run without additional options, with --timings, and with
>     --as-cran.   They produce equivalent check files. on their example
>     checks.
>
>     This behavior is on R 3.1.0, 3.1.1, and R-devel.
>
>     I would assume from the documentation that there should be a way to
>     get a clean check, without the timing diffs.
>
>     Advice appreciated,
>
>     Brian
>
>     Ref:
>     [1] http://cran.r-project.org/doc/__manuals/R-exts.pdf
>     <http://cran.r-project.org/doc/manuals/R-exts.pdf>
>



[Rd] timings for examples in R CMD check
Brian G. Peterson