[Rd] R CMD check for the R code from vignettes

Duncan Murdoch murdoch.duncan at gmail.com
Mon Jun 2 23:59:19 CEST 2014


On 03/06/2014, 4:12 AM, Gavin Simpson wrote:
> On 2 June 2014 11:44, Duncan Murdoch <murdoch.duncan at gmail.com
> <mailto:murdoch.duncan at gmail.com>> wrote:
>
>     On 03/06/2014, 12:58 AM, Yihui Xie wrote:
>
>         Please also note that I do not expect R core or CRAN maintainers
>         to do
>         any extra work: package authors can easily disable tangle by
>         themselves without anything special flags to R CMD build or R CMD
>         check. The vignettes are still built normally (in terms of
>         "weave"). I
>         brought forward the discussion to hear the possible harm that I was
>         potentially not aware of when we disable tangle for R package
>         vignettes (e.g. does it affect the quality of the package?). So
>         far I
>         have not heard real harm (I admit my judgment is subjective).
>
>
>     Several of us have told you the real harm:  it means that users
>     can't easily extract a script that replicates the computations done
>     in the vignette.  That's a useful thing to be able to do.
>
>
> Isn't the issue here that `tangle()` doesn't, currently, "extract a
> script that replicates the computations done in the vignette", but
> rather does so only partially?

No, I think the issue is that some people don't want to have to 
guarantee that the tangled source produces the same results.  R doesn't 
guarantee it, it is up to the author to do so.

>
> People seem to be arguing across one another throughout this thread.
> Yihui has identified an infelicity in the tangle implementation. Turning
> off tangling + sourcing in R CMD check may not be a desirable solution,
> so if the aim is to extract R code to replicate the computations in the
> vignette, tangle() needs to be modified to allow for inclusion
> (optional) of \Sexpr "chunks".

That's one solution, and the other is to limit \Sexpr code to things 
with no side effects, as Sweave was originally designed.

>
> To move this thread forwards, would contributions that added this
> optional feature to tangle() be considered by R Core? If so, perhaps
> those affected by the current infelicity might wish to propose patches
> to the R sources which implement a solution?

As I said before, I'm more sympathetic to that solution than to dropping 
the requirement that tangled code should work.  I think the changes to 
base R need only be minimal:  only an extra argument to the driver code 
for the tangling.  Users who want to use this feature should write their 
own (or use someone else's if they don't' mind an extra dependency) as a 
"non-Sweave vignette driver", whose implementation is to call Stangle 
with the non-default parameter setting.

Duncan Murdoch



More information about the R-devel mailing list