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.
I use roxygen for the package documentation
Interestingly, the output from Install and Restart says that it is installed:
==> devtools::document(roclets=c('rd', 'collate', 'namespace')) Updating DataReportR documentation Loading DataReportR Documentation completed ==> Rcmd.exe INSTALL --no-multiarch --with-keep.source DataReportR * installing to library 'C:/Program Files/R/library' * installing *source* package 'DataReportR' ... ** R ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded * DONE (DataReportR)
devtools::build_vignettes()
returns NULL
even though the lines
Suggests: knitr, rmarkdown VignetteBuilder: knitr
are included in the DESCRIPTION.
The YAML header of the vignette looks like this:
--- title: "My title" output: rmarkdown::html_vignette vignette: > %\\VignetteIndexEntry{Generate LaTeX tables for Data Reports} %\\VignetteEngine{rmarkdown::render} %\\usepackage[utf8]{inputenc} ---
I also tried to force building the vignette by devtools::build(vignettes = TRUE)
but nothing changed.
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.
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'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.