From Friedrich.Leisch at stat.uni-muenchen.de  Thu Apr 12 14:49:26 2007
From: Friedrich.Leisch at stat.uni-muenchen.de (Friedrich Leisch)
Date: Thu, 12 Apr 2007 14:49:26 +0200
Subject: [Rd] R CMD build fails with try(stop()) in vignette
In-Reply-To: <Pine.LNX.4.64.0704120731510.22931@nokomis.stat.uiowa.edu>
References: <6phps6aprpr.fsf@gopher4.fhcrc.org>
	<Pine.LNX.4.64.0704111726460.22931@nokomis.stat.uiowa.edu>
	<17950.5609.45983.142007@celebrian.ci.tuwien.ac.at>
	<Pine.LNX.4.64.0704120731510.22931@nokomis.stat.uiowa.edu>
Message-ID: <17950.10966.806919.930956@celebrian.ci.tuwien.ac.at>

>>>>> On Thu, 12 Apr 2007 07:35:28 -0500 (CDT),
>>>>> Luke Tierney (LT) wrote:

  > On Thu, 12 Apr 2007, Friedrich Leisch wrote:
  >>>>>>> On Wed, 11 Apr 2007 17:28:31 -0500 (CDT),
  >>>>>>> Luke Tierney (LT) wrote:
  >> 
  >> > It would appear that printing the error message to stderr() is what is
  >> > causing the build to fail; replace
  >> 
  >> >  	try(stop('err'))
  >> 
  >> > with
  >> 
  >> >  	cat('Error in try(stop("err")) : err\n', file = stderr())
  >> 
  >> > and I get the same failure.
  >> 
  >> Yes, both R CMD check and R CMD build "analyse" the textual output
  >> from running R (on examples, vigenttes, ...) to locate
  >> problems. Reason is a chicken&egg problem: You cannot use the same R
  >> process which runs the code to spot all problems, because it may not
  >> survive untilthe point where you are able to spot the problem.
  >> 
  >> Having errors thrown in code chunks is still in many ways an open
  >> problem in Sweave files, because it is hard to distinguish problems
  >> the user wants to show to the reader from ones that are not deliberate
  >> ...

  > Just to clarify: this means for now the recommendation would be for
  > authors of vignettes using try() to arrange to suppress the error
  > message either by adding silent=TRUE to the call or setting the
  > show.error.messages option to FALSE?

Yes. We should try to get a better system, but I'm not sure what that
should be (and definetely not for 2.5).

Most of the stuff is by Kurt, so we should wait for his opinion. If
you look at the R CMD check code you will see a lot of grep's for
"^Error", so merely inserting a blank before the error message may do
the trick, but we have no means to automate that yet.

.f



[Rd] R CMD build fails with try(stop()) in vignette
Friedrich Leisch