From murdoch.duncan at gmail.com  Mon Jun  2 23:59:19 2014
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Tue, 03 Jun 2014 06:59:19 +0900
Subject: [Rd] R CMD check for the R code from vignettes
In-Reply-To: <CAAHES9wXcvfzrCTAtz0XrOVeYzijno32WZ8seOh4LO+0ZzZd_A@mail.gmail.com>
References: <CANROs4dyoXEUEzouGTsL9sHCMM8RcjYWw9584SUAEYfGntPrFg@mail.gmail.com>	<538885F3.8020807@gmail.com>	<CANROs4eect+qAvXTLEzPhM=X2Eg5R0T-DCUBO6=VDfBFVJNCuQ@mail.gmail.com>	<CADwqtCN2XixFy0H43BeFMU7R_p+sQCaOHBU5W6tXn7Ng7pP1pA@mail.gmail.com>	<CANROs4c=x7BNDWJ7ObS5pB36+NBGzVmTmN7-94t8T+dowcEA5A@mail.gmail.com>	<538A63C6.5030201@fhcrc.org>	<CANROs4cM=q0isYqUO6eg2vWjT2HieUy996u7HtS8_deydFa-8g@mail.gmail.com>	<CADwqtCNQEAz==L4fSomQt+Ayw6wSo61-uM=xN_9K26K1XRoFwQ@mail.gmail.com>	<CANROs4cuHbSTeNXgBuWFAhpHGMVdGLsAs5gFH+8s=HCq8NYiwQ@mail.gmail.com>	<CAN_1p9wgx57ZRAYz56m+-51_UMYTtm97-JmpYSKYtHSobLkOzQ@mail.gmail.com>	<CADwqtCP=PJR=hDx9KSjs4HeSaqdgpdLZR-EpS0a5A2DPcW_7=Q@mail.gmail.com>	<538C960B.2040509@gmail.com>	<CANROs4fyMwi9=+h=78sXxcp4L8oH=WFSP_fighbzT8h_qa0b8Q@mail.gmail.com>	<538CB807.7050100@gmail.com>
	<CAAHES9wXcvfzrCTAtz0XrOVeYzijno32WZ8seOh4LO+0ZzZd_A@mail.gmail.com>
Message-ID: <538CF3B7.2060007@gmail.com>

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



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