From xie at yihui.name  Sun Jun  1 03:54:09 2014
From: xie at yihui.name (Yihui Xie)
Date: Sat, 31 May 2014 20:54:09 -0500
Subject: [Rd] R CMD check for the R code from vignettes
In-Reply-To: <538A63C6.5030201@fhcrc.org>
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>
Message-ID: <CANROs4cM=q0isYqUO6eg2vWjT2HieUy996u7HtS8_deydFa-8g@mail.gmail.com>

I mentioned in my original post that Sweave()/knit()/... can be
considered as the "new" source(). They can do the same thing as
source() does. I agree that fully evaluating the code is valuable, but
it is not a problem since the weave functions do fully evaluate the
code. If there is a reason for why source() an R script is preferred,
I guess it is users' familiarity with .R instead of .Rnw/.Rmd/...,
however, I guess it would be painful to read the pure R script tangled
from the source document without the original narratives.

So what do we really lose if we turn off tangle? We lose an R script
as a derivative from the source document, but we do not lose the code
evaluation.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Web: http://yihui.name


On Sat, May 31, 2014 at 6:20 PM, Martin Morgan <mtmorgan at fhcrc.org> wrote:
> On 05/31/2014 03:52 PM, Yihui Xie wrote:
>>
>> Note the test has been done once in weave, since R CMD check will try
>> to rebuild vignettes. The problem is whether the related tools in R
>> should change their tangle utilities so we can **repeat** the test,
>> and it seems the answer is "no" in my eyes.
>>
>> Regards,
>> Yihui
>> --
>> Yihui Xie <xieyihui at gmail.com>
>> Web: http://yihui.name
>>
>>
>> On Sat, May 31, 2014 at 4:54 PM, Gabriel Becker <gmbecker at ucdavis.edu>
>> wrote:
>>>
>>>
>>>
>>>
>>> On Fri, May 30, 2014 at 9:22 PM, Yihui Xie <xie at yihui.name> wrote:
>>>>
>>>>
>>>> Hi Kevin,
>>>>
>>>>
>>>> I tend to adopt Henrik's idea, i.e., to provide vignette
>>>> engines that just ignore tangle. At the moment, it seems R CMD check
>
>
> It is very useful, pedagogically and when reproducing analyses, to be able
> to source() the tangled .R code into an R session, analogous to running
> example code with example(). The documentation for ?Stangle does read
>
>      (Code inside '\Sexpr{}' statements is ignored by 'Stangle'.)
>
> So my 'vote' (recognizing that I don't have one of those) is to incorporate
> \Sexpr{} expressions into the tangled code, or to continue to flag use of
> Sexpr with side effects as errors (indirectly, by source()ing the tangled
> code), rather than writing engines that ignore tangle.
>
> It is very valuable to all parties to write a vignette with code that is
> fully evaluated; otherwise, it is too easy for bit rot to seep in, or to
> 'fake' it in a way that seems innocent but is misleading.
>
> Martin Morgan



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