I'm having trouble using pkgdown
with knitr's code externalisation and include_graphics commands. As an illustration, consider the following Rmd file placed in the vignettes/test/ subdirectory of pkgdown's source itself.
---
title: "Test: problem"
---
```{r nobacon}
knitr::include_graphics('bacon.jpg')
```
```{r externalise}
knitr::read_chunk("run.R")
```
```{r gg}
```
with the R code in run.R
being,
## ----gg----
library(ggplot2)
qplot(1,1)
Running pkgdown::build_site()
results in the following error:
── Building articles ───────────────────────────────────────────────────────────
Reading 'vignettes/test/problem.Rmd'
Writing 'articles/test/problem.html'
Quitting from lines 18-19 (/var/folders/s1/d92rwnjd6y98_0xn7cxdl4p00000gn/T//Rtmpq8MrIo/filee0202202a7.md)
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") : cannot open file 'run.R': No such file or directory
Error: callr subprocess failed: cannot open the connection
Execution halted
Curiously, run.R
is clearly found as the ggplot is actually created and shown on the output under docs/dev/articles/test/
The bacon picture is absent, with a broken link, although it works fine if given as simple md syntax as in the original examples ![](bacon.jpg)
.
Are there known workarounds for both problems?