From ripley at stats.ox.ac.uk  Thu May 18 16:47:35 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu, 18 May 2006 15:47:35 +0100 (BST)
Subject: [Rd] R CMD check: checking examples: how to (not) pause
	execution
In-Reply-To: <446C84B0.2060102@bank-banque-canada.ca>
References: <793FF35679078340BCDDA196B495E57EC272@spree.pcpool.mi.fu-berlin.de>
	<446C84B0.2060102@bank-banque-canada.ca>
Message-ID: <Pine.LNX.4.64.0605181545050.16258@gannet.stats.ox.ac.uk>

On Thu, 18 May 2006, Paul Gilbert wrote:

> I think the more usual way to solve this is to have the user set 
> par(ask=TRUE) is they want to be prompted. This gives the user the option of 
> being prompted, or not. It makes the example tests work, and simplifies your 
> code because you don't need to worry about the prompt mechanism. It also 
> potentially helps with multi-language support, etc, etc.

And in R-devel example() has an 'ask' argument that has a sensible 
default which sets par(ask=TRUE) when it looks like an interactive 
session.

>
> Paul
>
> Lutz Prechelt wrote:
>
>> Hello all,
>> 
>> trying to prepare my first package for submission to CRAN I am stumbling 
>> over the "checking examples" step
>> of R CMD check.
>> 
>> I have some examples that produce more than one plot.
>> I currently separate those plot calls by
>>  readline("Press <Return> for a plot including a density plot")
>> or some such to have R wait before producing the next plot.
>> 
>> This works OK for end users, but fails miserably during R CMD check, which 
>> appears to just eat the
>> next line of the example source file for the input of readline
>> (which took me quite a while to understand it).
>> 
>> What is the right way to solve this problem?
>> 
>> I can hardly believe that there is none (although the
>> examples of 'plot' suggest exactly this: They run through multiple plots in 
>> a hurry.)
>> 
>> I guess the appropriate approach would be if
>> example() had some kind of single-stepping option?
>> 
>> Any hints?
>>
>>  Lutz Prechelt
>> 
>> P.S.: Documentation remark:
>> For users struggling with R CMD check it might be
>> very helpful if R-exts.pdf contained some pointers
>> to the functions or mechanisms used by R CMD check, or the names of source 
>> files where to find such information
>> so they can better understand what is going on.
>> 
>> Prof. Dr. Lutz Prechelt; prechelt at inf.fu-berlin.de
>> Institut fuer Informatik; Freie Universitaet Berlin
>> Takustr. 9; 14195 Berlin; Germany
>> +49 30 838 75115; http://www.inf.fu-berlin.de/inst/ag-se/
>> 
>> ______________________________________________
>> 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



[Rd] R CMD check: checking examples: how to (not) pause execution
Prof Brian Ripley