I have also been searching for the holy grail of the right workflow for putting together an R large project. Last year, I found this package called rsuite, and, certainly, it was what I was looking for. This R package was explicitly developed for deployment of large R projects, but I found that it can be used for smaller, medium size, and large size R projects. I will give links to real-world examples in a minute (below), but first, I want to explain the new paradigm of building R projects with rsuite
.
Note. I am not the creator or developer of rsuite
.
We have been doing projects all wrong with RStudio; the goal shouldn't be the creation of a project or a package but of a larger scope. In rsuite you create a super-project or master project, which holds the standard R projects and R packages, in all combinations possible.
By having an R super-project you don't need anymore Unix make
to manage the lower levels of the R projects underneath; you use R scripts at the top. Let me show you. When you create a rsuite master project, you get this folder structure:

The folder R
is where you put your project management scripts, the ones that will replace make
.
The folder packages
is the folder where rsuite
holds all the packages that compose the super-project. You can also copy paste a package that is not accessible from the internet, and rsuite will build it as well.
the folder deployment
is where rsuite
will write all the package binaries that were indicated in the packages DESCRIPTION
files. So, this makes, by itself, you project totally reproducible accros time.
rsuite
comes with a client for all operating systems. I have tested them all. But you can also install it as an addin
for RStudio.
rsuite
also lets you build an isolated conda
installation in its own folder conda
. This is not an environment but a physical Python installation derived from Anaconda in your machine. This works together with R's SystemRequirements
, from which you could install all the Python packages you want, from any conda channel you want.
You can also create local repositories to pull R packages when you are offline, or want to build the whole thing faster.
If you want, you can also build the R project as a zip file and share it with colleagues. It will run, providing your colleagues have the same R version installed.
Another option is building a container of the whole project in Ubuntu, Debian, or CentOS. So, instead of sharing a zip file with your project build, you share the whole Docker
container with your project ready to run.
I have been experimenting a lot with rsuite
looking for full reproducibility, and avoid depending of the packages that one installs in the global environment. This is wrong because as soon as you install a package update, the project, more often than not, stops working, specially those packages with very specific calls to a function with certain parameters.
The first thing I started to experiment was with bookdown
ebooks. I have never been lucky enough to have a bookdown to survive the test of time longer than six months. So, what I did is converting the original bookdown project to follow the rsuite
framework. Now, I don't have to worry about updating my global R environment, because the project has its own set of packages in the deployment
folder.
The next thing I did was creating machine learning projects but in the rsuite
way. A master, orchestrating project at the top, and all sub-projects and packages to be under the control of the master. It really changes the way you code with R, making you more productive.
After that I started working in a new package of mine called rTorch
. This was possible, in large part, because of rsuite
; it lets you think and go big.
One piece of advice though. Learning rsuite
is not easy. Because it presents a new way of creating R projects, it feels hard. Do not dismay at the first attempts, continue climbing the slope until you make it. It requires advanced knowledge of your operating system and of your file system.
I expect that one day RStudio
allows us to generate orchestrating projects like rsuite
does from the menu. It would be awesome.
Links:
RSuite GitHUb repo
r4ds bookdown
keras and shiny tutorial
moderndive-book-rsuite
interpretable_ml-rsuite
IntroMachineLearningWithR-rsuite
clark-intro_ml-rsuite
hyndman-bookdown-rsuite
statistical_rethinking-rsuite
fread-benchmarks-rsuite
dataviz-rsuite
retail-segmentation-h2o-tutorial
telco-customer-churn-tutorial
sclerotinia_rsuite