Have you put dplyr in 'Suggests'? This should do.

Note that R CMD check runs the code in vignettes twice - once during building 
and then again the tangled R code file.
So the error may come from the second run. You can check this locally by 
telling knitr not to clean up after building the vignette and inspecting the 
generated R file.

I think that in recent versions of knitr there is an option to prevent 
generating the R file in the first place, so this may solve the problem.

Georgi

--
Dr Georgi Boshnakov               tel: (+44) (0)161 306 3684
School of Mathematics             fax: (+44) (0)161 306 3669
Alan Turing Building 1.125
The University of Manchester      email: georgi.boshna...@manchester.ac.uk
Oxford Road
Manchester M13 9PL
UK


-----Original Message-----
From: R-package-devel [mailto:r-package-devel-boun...@r-project.org] On Behalf 
Of Tim Keitt
Sent: 10 January 2018 05:49
To: R Package Devel
Subject: [R-pkg-devel] (no subject)

I'm seeing:

* checking re-building of vignette outputs ... [3s] WARNING
> Error in re-building vignettes:
> ...
> Quitting from lines 24-60 (strider.Rmd)
> Error: processing vignette 'strider.Rmd' failed with diagnostics:
> package 'dplyr' is not installed for 'arch = x64'
> Execution halted



I'm a little confused because my vignette avoids loading any packages that are 
not available. Is this because the "eval" option is not available in the 
version of knitr used by CRAN?

Here's the vignette code:

>
> ---
> title: "The Strider Package"
> author: "Timothy H. Keitt"
> date: "`r Sys.Date()`"
> output: rmarkdown::html_vignette
> vignette: >
>   %\VignetteIndexEntry{Vignette Title}
>   %\VignetteEngine{knitr::rmarkdown}
>   %\VignetteEncoding{UTF-8}
> ---
> ```{r include=FALSE}
> has_packages = all(c("dplyr", "ggplot2", "microbenchmark") %in%
> rownames(installed.packages()))
> not_has_packages = !has_packages
> ```
> ```{r echo=FALSE, eval=not_has_packages}
> cat("Error: You must install dplyr, ggplot2 and microbenchmark to run 
> the code in this vignette.") ``` ```{r include=FALSE, message=FALSE, 
> warning=FALSE, eval=has_packages}
> library(dplyr)
> library(ggplot2)
> library(microbenchmark)
> ...


This works fine on my computer even if I uninstall dplyr, etc. But it appears 
that when CRAN tries to rebuild the vignette, the "eval" flag is ignored?

Tricky to reproduce as the exact code used to regenerate the vignette is not 
part of the output.

THK


http://www.keittlab.org/

        [[alternative HTML version deleted]]

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

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

Reply via email to