I am currently tracking R package dependencies in one of my projects with
renv works great when launching R sessions or calling scripts from the project's root directory (where
.Rprofile reside), many of the used R scripts are not placed at the top level directory but rather in a chain of subdirectories, e.g.
project-root ├── long-directory-name │ └── even-longer-subdirectory-name │ ├── script-1.R │ ├── ... │ └── script-n.R ├── renv └── renv.lock
Invoking these scripts by using the full path starting at the project's root folder is possible and enables correct usage of the package library installed through
renv. However, I find myself often wanting to
cd into the specific subfolder and launching the script from within these subfolders without having to type out long path names over and over again.
Surely, I am not the only one concerned with this problem but I am currently not aware of a better solution than to create
.Rprofile files in every subdirectory and manually sourcing the top-level
.Rprofile from within them. There must a better way
Thanks for helping and answering my possibly basic R question