Multiple Rproj in a single GitHub repo

Before my current team, every 1 GitHub repo = 1 Rproj and life was good. Now, 1 GitHub repo = many Rproj: our main GitHub repo holds most of our modeling/analysis code, and we typically open up subfolders for specific projects. To work on the projects more easily, each project folder houses an Rproj and lives on its own branch until it's completed.

When working on two projects simultaneously, it can get confusing. If you create a new Rproj/subfolder on a branch, you can't open it from RStudio unless you switch branches via the terminal/Git client (because the Rproj itself doesn't exist in certain branches).

Overall this set-up is something I can work with (like creating folders/Rproj on master first or just using a Git client), but has many points of friction. Any guidance or suggestions on how to better deal with this workflow is appreciated! :slight_smile:


I think rather than having multiple R projects / packages in one repo you are better off creating a GitHub organization with multiple git projects inside it. Then each project can have branches, separate issues etc.


I understand the benefit of the multi-repo approach, but the volume (~10 people working on 1-2 analysis projects/month) makes finding and navigating between these repos a problem. Not sure if we can split our team from the GH organization that is shared across the company, but in any case, a total organizational overhaul likely out of my control. :confused:

In the process of thinking about this problem, I discovered vibrant debates about "monorepos" versus "polyrepos" in the software development world. I feel like many of the cost/benefits are similar in this case, but a major advantage of the monorepo approach for data science is that it better preserves relationships between small (1-2 mo) analysis projects.

A hacky fix I've had for this (which isn't ideal!) is having an .Rproj in each subfolder (project), and also an .Rproj in the main folder (repo) -- then you can open the repo .Rproj, switch branches, and open the project .Rproj. I don't know if it's much different than using the terminal or a git client to switch branches, but at least it keeps the whole workflow inside RStudio.

1 Like

Cool, I'll keep that in mind! Pretty similar to the git client approach but yes, it's nice not to have to switch programs.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.