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

2014-06-04 Thread Duncan Murdoch
On 03/06/2014, 2:04 PM, Yihui Xie wrote: As I pointed out, \Sexpr{} is not the only potential problem. Besides, side effects are not necessarily evil in all cases. Since I have been described as "nitpicky", it is time for me to quit the discussion now In that case I'll also consider the issue

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

2014-06-02 Thread Yihui Xie
As I pointed out, \Sexpr{} is not the only potential problem. Besides, side effects are not necessarily evil in all cases. Since I have been described as "nitpicky", it is time for me to quit the discussion now (adjectives on personal pronouns instead of nouns in a discussion is a sign for me to q

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

2014-06-02 Thread Kevin Coombes
"Doc, it hurts when I do this." "So, don't do that." If no one in R Core does anything about this issue (in terms of changing Sweave or Stangle), then the solution still remains very simple. Authors of vignettes should avoid using anything in \Sexpr{} that has a side effect. As long as they d

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

2014-06-02 Thread Gavin Simpson
On 2 June 2014 15:59, Duncan Murdoch wrote: > On 03/06/2014, 4:12 AM, Gavin Simpson wrote: > >> On 2 June 2014 11:44, Duncan Murdoch > > wrote: >> >> > Several of us have told you the real harm: it means that users >> can't easily extract a script t

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

2014-06-02 Thread Duncan Murdoch
On 03/06/2014, 4:38 AM, Yihui Xie wrote: Well, there is still misunderstanding: there is nothing that really stops you from tangling the vignettes, and I do not disagree that tangle can be useful in certain cases. I'm talking about whether package authors _must_ tangle all their vignettes, Yes,

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

2014-06-02 Thread Duncan Murdoch
On 03/06/2014, 4:12 AM, Gavin Simpson wrote: On 2 June 2014 11:44, Duncan Murdoch mailto:murdoch.dun...@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

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

2014-06-02 Thread Gabriel Becker
As far as I understand, the purpose of vignettes is to document the functions/objects provided by the package. If we consider vignettes documentation, then having code in the vignette which won't run outside of a dynamic document is akin to having an example which runs correctly when you call exa

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

2014-06-02 Thread Yihui Xie
Well, there is still misunderstanding: there is nothing that really stops you from tangling the vignettes, and I do not disagree that tangle can be useful in certain cases. I'm talking about whether package authors _must_ tangle all their vignettes, or leave some to users to run Stangle() or knitr:

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

2014-06-02 Thread Gavin Simpson
On 2 June 2014 11:44, Duncan Murdoch 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

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

2014-06-02 Thread Duncan Murdoch
On 03/06/2014, 12:58 AM, Yihui Xie wrote: Yes, I completely agree the tangle code should run without errors, if the package author has provided such a script. However, I think it is also the package author's right to choose not to provide such a script, for reasons that I stated in the beginning

Re: [Rd] R CMD check for the R code from vignettes -- thread fraying?

2014-06-02 Thread Yihui Xie
ettiger , >> Gabriel Becker Cc: Henrik Bengtsson >> , R-devel Subject: Re: [Rd] >> R CMD check for the R code from vignettes Message-ID: >> <538c0654.7050...@gmail.com> Content-Type: text/plain; >> charset=ISO-8859-1; format=flowed On 02/06/2014, 1:41 PM, Carl Boet

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

2014-06-02 Thread Yihui Xie
Yes, I completely agree the tangle code should run without errors, if the package author has provided such a script. However, I think it is also the package author's right to choose not to provide such a script, for reasons that I stated in the beginning (1. redundancy; 2. tangle functions ignore i

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

2014-06-02 Thread Paul Gilbert
On 06/02/2014 12:16 AM, Gabriel Becker wrote: Carl, I don't really have a horse in this race other than a strong feeling that whatever check does should be mandatory. That having been said, I think it can be argued that the fact that check does this means that it IS in the R package vignette

Re: [Rd] R CMD check for the R code from vignettes -- thread fraying?

2014-06-02 Thread Prof J C Nash (U30A)
s are causing misunderstandings. JN On 14-06-02 06:00 AM, r-devel-requ...@r-project.org wrote: > Message: 4 Date: Mon, 02 Jun 2014 14:06:28 +0900 From: Duncan Murdoch > To: Carl Boettiger , > Gabriel Becker Cc: Henrik Bengtsson > , R-devel Subject: Re: [Rd] > R CMD check for the R

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

2014-06-01 Thread Duncan Murdoch
On 02/06/2014, 1:41 PM, Carl Boettiger wrote: Thanks both for the replies. Duncan, I'm sorry if I wasn't clear. I am indeed writing a vignette using Sweave (knitr actually), and I want it to be a vignette. I'm well aware that I can dodge these tests as you suggest, or through other ways, but I'

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

2014-06-01 Thread Carl Boettiger
Thanks both for the replies. Duncan, I'm sorry if I wasn't clear. I am indeed writing a vignette using Sweave (knitr actually), and I want it to be a vignette. I'm well aware that I can dodge these tests as you suggest, or through other ways, but I'm not trying to dodge them. R CMD check is runn

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

2014-06-01 Thread Gabriel Becker
Carl, I don't really have a horse in this race other than a strong feeling that whatever check does should be mandatory. That having been said, I think it can be argued that the fact that check does this means that it IS in the R package vignette specification that all vignettes must be such that

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

2014-06-01 Thread Carl Boettiger
Yihui, list, Focusing the behavior of R CMD check, the only reason I have seen put forward in the discussion for having check tangle and then source as well as knit/weave the very same vignette is to assist the package maintainer in debugging R errors vs pdflatex errors. As tangle (and many other

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

2014-05-31 Thread Yihui Xie
1. The starting point of this discussion is package vignettes, instead of R scripts. I'm not saying we should abandon R scripts, or all people should write R code to generate reports. Starting from a package vignette, you can evaluate it using a weave function, or evaluate its derivative, namely an

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

2014-05-31 Thread Yihui Xie
Yes, that is a matter of familiarity as I mentioned, isn't it? I understand this justification. I can argue that it is also convenient to give people an Rnw/Rmd document and they can easily run the R code chunks as well (e.g. in RStudio, chunk navigation and evaluation are pretty simple) _within_ t

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

2014-05-31 Thread Gabriel Becker
On Sat, May 31, 2014 at 6:54 PM, Yihui Xie wrote: 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 instea

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

2014-05-31 Thread Kasper Daniel Hansen
The Bioconductor project has a substantial amount of teaching material in the form of Sweave files. For teaching, it can be extremely convenient to give people an R script which they can copy and paste from (or do something else with). This is especially true for inexperienced R users. Best, Kas

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

2014-05-31 Thread Yihui Xie
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 w

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

2014-05-31 Thread Martin Morgan
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. Regar

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

2014-05-31 Thread Gabriel Becker
Vignettes can fail to build for reasons unrelated to code. In that case it seems useful to the developer to know whether the the code is failing (indicating a likely problem in the package itself) or just the TeX in the vignette. Also, I could be wrong about this, but I thought the "run the vign

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

2014-05-31 Thread Yihui Xie
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 Web: http://yihui.n

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

2014-05-31 Thread Gabriel Becker
On Fri, May 30, 2014 at 9:22 PM, Yihui Xie 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 > is comfortable with vignettes that do not have corresponding R > scripts, and I hope these R scripts

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

2014-05-30 Thread Yihui Xie
Hi Kevin, Personally I also avoid code that have side effects in the inline expressions, but I think there are legitimate use cases in which inline expressions have side effects. This discussion was motivated by Carl's knitcitations package, as well as another question on StackOverflow (http://sta

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

2014-05-30 Thread Henrik Bengtsson
Sorry, it should be Yihui and nothing else. /Henrik On Fri, May 30, 2014 at 10:15 AM, Henrik Bengtsson wrote: > I think there are several aspects to Yihue's post and some simple > workarounds/long solutions to the issues: > > 1. For the reasons argued, I would agree that 'R CMD check' > incorrec

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

2014-05-30 Thread Henrik Bengtsson
I think there are several aspects to Yihue's post and some simple workarounds/long solutions to the issues: 1. For the reasons argued, I would agree that 'R CMD check' incorrectly assumes that tangled code script should be able to run without errors. Instead I think it should only check the synta

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

2014-05-30 Thread Carl Boettiger
Hi Yihui, I agree with you (and your comments in [knitr issue 784]) that it seems wrong for R CMD check to be using tangle (purl, etc) as a way to check R code in a vignette, when the standard and expected way to check the vignette is already to knit / Sweave the vignette. I also agree with the p

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

2014-05-30 Thread Kevin Coombes
Hi, Unless someone is planning to change Stangle to include inline expressions (which I am *not* advocating), I think that relying on side-effects within an \Sexpr construction is a bad idea. So, my own coding style is to restrict my use of \Sexpr to calls of the form \Sexpr{show.the.value.of

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

2014-05-29 Thread Yihui Xie
Hi, Recently I saw a couple of cases in which the package vignettes were somewhat complicated so that Stangle() (or knitr::purl() or other tangling functions) can fail to produce the exact R code that is executed by the weaving function Sweave() (or knitr::knit(), ...). For example, this is a vali