My pleasure @jmichaelrosenberg. My initial reaction is that a flatter file system might be better:
| rootDir/
|
|---- rootDir.Rproj
|
|---- data/
|---- ---- data1.csv
|---- ---- data2.csv
|---- ---- data3.csv
|
|---- docs/
|---- ---- doc1.Rmd
|---- ---- doc2.Rmd
|---- ---- doc3.Rmd
This file system is based on some sage wisdom about project organization.
From any of those notebooks, a call like this should work as you want it to in my suggested file system:
df <- readr::read_csv(here("data", "data1.csv"))
I would specify the file paths directly in those calls rather than using here::set_here() - I suspect that you are getting some conflicts between your here::set_here() instructions and where the .Rproj file is. here() looks for that .Rproj file and uses that as its way of identifying which directory is the root.
If you want the more complex file system for whatever reason, a call like this should also work:
df <- readr::read_csv(here("doc1", "data", "data1.csv"))
Another thing that might be complicating things is if you are using knitr functions to try and set the directories your .Rmd files are looking in (something like knitr::opts_knit$set(root.dir = here::here())). As I found out the hard way, here() does not play well with those.