For starters, I have set the option Tools/Global Options/R markdown evaluate chunks in directory project. So, the paths should be relative to the project. I use the following code format in the chunk:
```{r figure}
#| fig.cap=cap,
#| echo=FALSE
knitr::include_graphics(here("relative/path/to/figure.png"))
cap <- "Figure caption."
```
The error looks like:
Error in knitr::include_graphics(here("relative/path/to/figure.png")):
Cannot find the file(s): "../../../relative/path/to/figure.png"
...
The previous paths on the chunks work, if I move to the rmarkdown location in the terminal and I go up three positions (as it is in the error) the path is still correct.
I just do not understand why this error keeps appearing.
Any help will be appreciated,
Thank you