I have two folders (folder1, and folder2) nested inside my project_folder. Folder2 is my working directory and it is where I kept my RMarkdown files and their output. Folder1 is where I keep my picture and data files. I am trying to insert a .jpg file from folder1 while compiling and working in the folder 2 directory. I tried to do this:
```{r Chunk1, echo = FALSE, message = FALSE, warning = FALSE, error = FALSE, comment = NA, fig.align = "center", results = 'asis'}
#Set the wd one step back
knitr::opts_knit$set(root.dir = setwd('..'))
#Call the picture
knitr::include_graphics('/folder1/external/picture1.jpg')
```
But I keep receiving the error that the program cannot find the file:
Error in knitr::include_graphics("/folder1/external/picture1.jpg") : Cannot find the file(s): "/folder1/external/picture1.jpg" Calls: <Anonymous> . . . withCallingHandlers -> withVisible -> eval -> eval -> <Anonymous> In addition: Warning message: package 'knitr' was built under R version 3.5.2. Execution halted.
Is there another way to do this? What am I doing wrong here?