You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The notebook is in R/Rmd1/notebook1.Rmd. If I run the notebook in RStudio everything works.
Knit the document to get the following error:
Relevant bits about the example:
I usually keep notebooks in subdirectories of the project, tipically under R/.
I like to set knitr::opts_knit$set(root.dir = here::here()) at the setup chunk, so paths in chunks are always relative to the project while I'm working.
I like to save knitted documents to output/renders (again relative to the project's root) by setting knit in the YAML header to the following function: rmarkdown::render(inputFile, encoding = encoding, output_dir = "output/renders").
If i omit the include_graphics call, Knit works and R is able to find the file with file.exists: notebook1.pdf
If instead of normalizing the path I pass a path relative to the project's root, using knitr::include_graphics("results/image_1.png"). I get a different error:
! Unable to load picture or PDF file 'results/image_1.png'.
<to be read again>
}
l.174 \includegraphics{results/image_1.png}
I would appreciate if someone could point me in the right direction. What path should I pass to include_graphics in this case?
I'm submitting this as a bug report because I have been unable to find out why this happens, everything else seems to work, and it is unexpected behavior from my perspective.
I have provided the necessary information about my issue.
If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('knitr'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/knitr').
If I have posted the same issue elsewhere, I have also mentioned it in this issue.
I have learned the Github Markdown syntax, and formatted my issue correctly.
I understand that my issue may be closed if I don't fulfill my promises.
Hi!
I'm having difficulties including images during knitting.
Here is a reproducible example: test.zip
The notebook is in
R/Rmd1/notebook1.Rmd. If I run the notebook in RStudio everything works.Knit the document to get the following error:
Relevant bits about the example:
R/.knitr::opts_knit$set(root.dir = here::here())at the setup chunk, so paths in chunks are always relative to the project while I'm working.output/renders(again relative to the project's root) by settingknitin the YAML header to the following function:rmarkdown::render(inputFile, encoding = encoding, output_dir = "output/renders").If i omit the
include_graphicscall, Knit works and R is able to find the file withfile.exists: notebook1.pdfIf instead of normalizing the path I pass a path relative to the project's root, using
knitr::include_graphics("results/image_1.png"). I get a different error:I would appreciate if someone could point me in the right direction. What path should I pass to
include_graphicsin this case?I'm submitting this as a bug report because I have been unable to find out why this happens, everything else seems to work, and it is unexpected behavior from my perspective.
Thank you for all the work you've done :)
Best!
N.
By filing an issue to this repo, I promise that
xfun::session_info('knitr'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('yihui/knitr').I understand that my issue may be closed if I don't fulfill my promises.
Session info: