0

I am making a DB client package with a knitr/rmarkdown vignette that demonstrates some basic use-cases.

I would like it to be present in the CRAN version of the package, but obviously it won't build there because of the lack of the DB server.

What is a canonical way of dealing with that?

mbq
  • 18,510
  • 6
  • 49
  • 72

1 Answers1

0

As far as I know, CRAN doesn't rebuild vignette, it just use the html/pdf you build locally. So are you sure when you build your package, it contains the vignette you want? You can check it here: http://r-pkgs.had.co.nz/vignettes.html#vignette-cran

Edit:

For the vignette to pass the R CMD check, this is my method:

Firstly, do this for your Rmd file, this will generate the md file for the vignette,

output:
  md_document:
    toc: true
  rmarkdown::html_vignette:
    toc: true

Secondly, copy the md file and other output files (like pictures) into your vignette folder, rename the folder for the output files into something else and make corresponding changes in your md file.

Finally, move your original Rmd file and rename the md file to Rmd, make changes to your md file (like adding vignette header) for it to look like an Rmd file for vignette. The new Rmd file will pass the R CMD check easily and quickly.

Consistency
  • 2,884
  • 15
  • 23
  • CRAN does rebuild it as a check, and it throws warnings when not successful, [like here](https://cran.r-project.org/web/checks/check_results_ezknitr.html). Thus I think there is some better way than just ignore it. – mbq Jun 15 '17 at 20:57
  • I think one method is to turn your original Rmd file into plain md without any R command, and the CRAN check will simply pass, include it in the bundle you upload to CRAN without the original version. – Consistency Jun 15 '17 at 21:22
  • Probably not kosher enough anymore: https://stackoverflow.com/questions/19716498/using-a-static-prebuilt-pdf-vignette-in-r-package – mbq Jun 16 '17 at 11:34
  • @mbq My meaning is not to use plain html or pdf, but to use md generated from Rmd instead (md is still valid Rmd file). Maybe you can file knit your Rmd to md, and rename the md files. You need to make certain change to the generated md file to include the vignette header. And then you remove the original Rmd and rename the md to Rmd. At least this trick seems to work on my own machine with the R CMD check. – Consistency Jun 16 '17 at 14:14
  • @mbq By the way, if followed my suggestion, you'd better to rename the folder name of the output files (like pictures), otherwise it seems knit engine will do some automatically clean up. – Consistency Jun 16 '17 at 14:22
  • @mbq Make edit to my original answer, my way of generating md file and renaming md to Rmd works for my own package, although it is not that elegant and requires some manual work. – Consistency Jun 18 '17 at 01:53