Re: [Rd] Generate .Rout.save files for vignettes

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue, 11 Dec 2012 18:23:52 +0000

On 11/12/2012 17:27, Duncan Murdoch wrote:
> On 12-12-11 9:41 AM, Prof Brian Ripley wrote:
>> But note that this was added at the request of one package author. We
>> don't generally recommended it, not least as people do not take
>> sufficient care about platform differences and keeping such output up to
>> date. So people (including authors) tend to simply ignore a mass of
>> differences.
>>
>> It is better to craft tests with controlled output (and chosen number of
>> significant digits) if you want to check package printed output.
>
> This seems like a useful test for a package developer, but maybe not for
> package users (or for CRAN, if the developer wants to work in a
> non-standard locale).
>
> I wonder if there's a way to make it easy to use locally, without
> inconveniencing everyone else? Perhaps it should simply default to not
> being done, with an environment variable flag set to enable it.

What I do (and CRAN recommends for author-mode tests) is to have such a .save file excluded by .Rbuildignore.

>
> Duncan Murdoch
>
>
>>
>>
>> On 11/12/2012 13:52, Duncan Murdoch wrote:
>>> On 12-12-10 11:45 AM, Benjamin Hofner wrote:
>>>> I am looking for a way to generate .Rout.save files for vignettes.
>>>> The manual "Writing R Extensions" states here [1] in item number 20:
>>>>
>>>> "If there is a target output file .Rout.save in the vignette source
>>>> directory, the output from running the code in that vignette is
>>>> compared
>>>> with the target output file."
>>>>
>>>> Yet, there is no pointer on how to get the correct .Rout.save files for
>>>> vignettes. (For the files in directory "test" there is a footnote on
>>>> how
>>>> to get the .Rout.save files. [2])
>>>
>>> I agree, this should be documented. But it is rather easy:
>>>
>>> Just create an empty file and call it vignette.Rout.save. Run the
>>> checks, and you'll get lots of errors because it won't compare to the
>>> real output.
>>>
>>> When you get a compare failure, the file vignette.Rnw.log will be left
>>> in the *.Rcheck directory. You can just copy that into the
>>> vignette.Rout.save file.
>>
>> You need to watch out for locale differences: make sure you do this in
>> an English locale for portability (everyone has one of those, the 'C'
>> locale).
>>
>>>
>>> Duncan Murdoch
>>>
>>>>
>>>> As a temporary solution, we currently use a script that calls
>>>> tools:::.run_one_vignette() on each vignette and dumps the output:
>>>>
>>>> echo 'tools:::.run_one_vignette("vignette.Rnw", docDir = ".");' | R
>>>> --vanilla > vignette.Rout.save
>>>>
>>>> However, this doesn't result in the same code as produced by R CMD
>>>> check. E.g., we get the R startup header and furthermore get the output
>>>> in German where localization is available (thus having differences when
>>>> running R CMD check).
>>>>
>>>> Does anyone have any hints on how to automatically get the correct
>>>> results (i.e., without the header)? And is it possible to include these
>>>> hints in the "Writing R extensions" manual for other users?
>>>>
>>>> Any help is highly appreciated.
>>>> Best,
>>>> Benjamin
>>>>
>>>> --------------------
>>>> [1] http://cran.r-project.org/doc/manuals/R-exts.html#Checking-packages
>>>> [2] http://cran.r-project.org/doc/manuals/R-exts.html#fn-15
>>>>
>>>> ______________________________________________
>>>> R-devel_at_r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>>
>>>
>>> ______________________________________________
>>> R-devel_at_r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
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

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue 11 Dec 2012 - 18:29:48 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 11 Dec 2012 - 20:52:49 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive