Hi Tim,

Here's a rather long thread from previous discussions of this:

https://stat.ethz.ch/pipermail/r-devel/2014-May/069113.html

These two lines from R CMD check suggest the two ways the vignette code
will be run:

 * checking running R code from vignettes ... OK
 * checking re-building of vignette outputs ... OK

Chunk option `purl` controls whether a chunk is extracted and rerun
during “running R code from vignettes”.
Chunk option `eval` controls whether a chunk is run during the
“re-building of vignette outputs”.

Perhaps your benchmarking code is still being extracted and run during
the purl (a.k.a. "tangle") phase.

-- Jenny


On Mon, Mar 19, 2018 at 8:04 PM, Tim Keitt <tke...@utexas.edu> wrote:

> http://www.keittlab.org/
>
> On Mon, Mar 19, 2018 at 6:41 AM, Dirk Eddelbuettel <e...@debian.org> wrote:
>
> >
> > On 18 March 2018 at 21:57, Tim Keitt wrote:
> > | That's a great idea, however my problem is with building a vignette,
> not
> > | running tests, unless they are linked in some way I'm not
> understanding.
> >
> > Similar idea applies: condition, just as Inaki and Thierry suggested.  An
> > example for a conditional vignette evaluation is
> >
> > ```{r echo = FALSE, message = FALSE}`r ''`
> > hasData <- requireNamespace("hurricaneexposuredata", quietly = TRUE)
> >           #1
> > if (!hasData) {
> >          #2
> >     knitr::opts_chunk$set(eval = FALSE)
> >          #3
> >     msg <- paste("Note: Examples in this vignette require that the",
> >                  "`hurricaneexposuredata` package be installed. The
> > system",
> >                  "currently running this vignette does not have that
> > package",
> >                  "installed, so code examples will not be evaluated.")
> >     msg <- paste(strwrap(msg), collapse="\n")
> >     message(msg)
> >           #4
> > }
> > ```
> >
>
> That's a great solution. I've used something similar eg
> https://raw.githubusercontent.com/thk686/strider/master/
> vignettes/strider.Rmd
>
> I'm still confused however as I was sure that my code chunks were run
> during CRAN check even when the eval option was set to false. But its
> sounding like I made the wrong assumption. Not sure why it did not work
> before.
>
> THK
>
>
> >
> > and the paper (https://journal.r-project.org/archive/2017/RJ-2017-026/)
> by
> > Brooke Anderson and myself discusses #1 to #4.
> >
> > Dirk
> >
> > --
> > http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
> >
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

        [[alternative HTML version deleted]]

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to