rr-packagevignette

R: package vignette not built


Problem

I created a small internal package for my company. To describe hot to use it, I wrote a vignette. But for some reason, the vignette is not built when I hit Install and Restart in RStudio.

Further Information

EDIT (changed YAML header):

When I change %\VignetteEngine{rmarkdown::render} to %\VignetteEngine{knitr::rmarkdown} in the vignette's YAML header, devtools::build_vignettes() works and places the built vignette in /inst/doc/.

However, when I Check the package in RStudio, the check fails at this position:

** installing vignettes
** testing if installed package can be loaded
Error in namespaceExport(ns, exports) : 
  undefined exports: create_var_details, create_var_overview
Error: loading failed
Execution halted
ERROR: loading failed

Both create_var_details and create_var_overview are exported functions. Here an example:

... 
#' @export
#' 
    create_var_details <- function(...
...

With the old header, the checks were fine.


Solution

  • I figured out that R did not find pandoc. Thus, I added the pandoc path to the PATH environment variable. I also changed the vignette enginge to %\VignetteEngine{knitr::rmarkdown} as suggested in the comments by @R18.

    Now the vignette is properly built when I click on Install and Restart in RStudio.

    However, checking the package still does not work. See my EDIT to the question. But this in another question: R package: Adding a vignette causes 'undefined exports'