[Rd] R CMD check and error in an \Sexpr in an Rd file

Renaud Gaujoux renaud at mancala.cbio.uct.ac.za
Tue Nov 1 11:22:30 CET 2011


Getting back to the \Sexpr issue, I tried with R-2.14.0 and I still see 
the following issues:

- verbatim multiline is not shown properly on PDF 
(\Sexpr[results=verbatim, stage=render]{cat("line\nnext line")})
- verbatim with empty lines breaks PDF generation 
(\Sexpr[results=verbatim, stage=render]{cat("line\nnext line\n\nyet 
another line")}). Would there be an issue in using a plain Latex 
verbatim environment for \Sexpr[results=verbatim]?

- an error in an \Sexpr (\Sexpr[results=verbatim, 
stage=render]{stop("error in sexpr")}) gives the following in R CMD check:

* checking examples ... ERROR
Error in paste(before, x, after, sep = "") : object 'exfile' not found
Execution halted

The two first issues can be reproduced with a call to R CMD Rd2pdf on 
the Rd code below.

Thank you.
Renaud.

%%%%%%%%%%%
\name{Sexpr}
\alias{Sexpr}
\title{Error and verbatim in Sexpr}
\description{
   Testing Sexpr in Rd files

   %\Sexpr[results=verbatim, stage=render]{stop("error in sexpr")}

   \Sexpr[results=verbatim, stage=render]{cat("line\nnext line")}

   %\Sexpr[results=verbatim, stage=render]{cat("line\nnext line\n\nyet 
another line")}
}
%%%%%%%%%%%



-- 
Renaud Gaujoux
Computational Biology - University of Cape Town
South Africa


On 28/10/2011 17:25, Duncan Murdoch wrote:
> On 28/10/2011 10:53 AM, Duncan Murdoch wrote:
>> On 28/10/2011 10:49 AM, Renaud Gaujoux wrote:
>> >  Hi,
>> >
>> >  another Rd related issue I encountered is that if an error occurs 
>> in an
>> >  \Sexpr in an Rd file, then on get the following error:
>> >
>> >  * checking for portable compilation flags in Makevars ... OK
>> >  * checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
>> >  * checking examples ... ERROR
>> >  Error in paste(before, x, after, sep = "") : object 'exfile' not 
>> found
>> >  Execution halted
>> >
>> >  To reproduce, put a call like this in an Rd section:
>> >
>> >  \Sexpr[results=verbatim, stage=render]{x<- 1; stop("sexpr error")}
>> >
>> >  The strange thing is that it occurs at the example checking step.
>> >  Not sure why it does not break before.
>> >
>> >  Thank you.
>> >
>> >  Renaud
>> >
>> >  PS: I am on R version 2.13.2 (2011-09-30) - x86_64-pc-linux-gnu 
>> (64-bit)
>> >
>>
>> I would update to 2.13.2 patched, or the release candidate of 2.14.0.
>
> Oops, sorry, 2.13.2 is "final", so I didn't backport the patch.  
> 2.14.0 is what you should get.
>
> Duncan Murdoch



More information about the R-devel mailing list