My R project is structured like a package with directories /R, /vignettes, /data etc. In one of my Rmd docs in /vignettes
Where you have an R project with nested subfolders, so that the .Rproj and .Rmd files are located in different folders, you can use the command rprojroot::find_rstudio_root_file() to find and set the working directory to the Project's main folder during Kniting (instead of the folder containing the rMarkdown code file).
So at a minimum use the following:
```{r setup}
knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file())
```
inside the setup chunk.
See also Automatically finding the path of current R project in R Studio and https://support.rstudio.com/hc/en-us/community/posts/220826588-Working-directory-in-R-Notebooks.