1 min read

A Shareable R Workflow

If you, like me, work primarily in R, I bet you’ve pulled a colleague’s scripts, tried to load the data and, File Not Found Error.


Thanks to Jenny Bryan’s awesome blog post, I learned there’s a better solution that’s already made me overhaul my sharing workflow.

Thanks to the combination of RStudio Projects in RStudio and the here package, my woes with manually setting directories are over.

For a while, I’ve been using RStudio Projects since they’re a great way to keep work on different projects distinct. But I hadn’t considered the sharing implications…

Since the projects are stored in the form of a .Rproj file that’s easily shareable on git, they’re also super easy to share.

  1. Open Project (upper right corner in RStudio) by opening .Rproj file.
  2. Do work. Use here::here any time you need to refer to the working directory.
  3. Share the whole directory (including .Rproj) like a champ.

I’ve found that this workflow makes it super easy to share projects across a team without running into issues of how your machine’s directory structure is set up (especially useful for me as some on the team are on Windows and some on Mac). As long as your directory structure is the same within the project, no more lost files!