Solve the working directory insanity
wolass opened this issue · 3 comments
Please wait for some discussion of your request before making a Pull Request.
Problem
I'm always frustrated when i have to deal with working directory issues and cant load files. If they load in a R script , then they probably will not work when I source the .R script inside of my .Rmd paper or report... I usually do one statistical analysis file (stat.R) that I use in my paper.Rmd, and then Point-per-point-reply-to-reviewers-comments.Rmd.
In my opinion it is also good to divide the fast, vast and ugly stat analysis and select the gems out of it inside R objects that you can then call within the paper.Rmd file.
Proposed Solution
I want rrtools to use this package to deal with relative paths inside my working directory.
Alternatives
We leave it to the user and they will have to deal with it themselves.
Additional context
None
Currently we recommend to the user, via the paper.Rmd template, to use the here package to manage working directories. But let's remain open to better methods!
@wolass I started to think about this and admit that I find both rprojroot
as well as here
utterly confusing. I wonder whether we really can shelter the user from understanding the different build environments and their effect on relative file paths.
Maybe you could provide a concrete example where we should apply a change in the default templates to point the user to a better solution for the file path issue? We could as well add a sentence about this in the README.
- I am now using
here::here()
for giving ANY file paths. - I think we can't escape using any function at all (what would be the best solution)
- The user has to be aware of the fact that they need to use the here package, and I think It would be best if we write this in our exemplar
paper.Rmd
file. It makes things less easy to forget when they are directly loaded in front of our eyes every time we start a new project. WE could directly call thehere
lib at the beginning of the file. I made the proposed changes in a pull request