The goal of r4ds-rsuite
is providing an update resistant version of the book by installing r4ds
in its own environment, with its own packages, frozen at a time of your chosing.
I have cloned r4ds
on June 6, 2019, and immediately added a package under the folder packages called r4ds.book.pkgs
. This package contains all the packages required by r4ds
so it can run independently from the global environment.
To be able to do this, we use rsuite, an application with a client (Windows, Linux and Mac), a package RSuite
, and a RStudio addin. The application is open source and is available in Github.
I have been converting the most important and complex of my projects to rsuite
administered form. It really is a time saver because the dependencies or packages do not break after doing a global update of R packages.
- Download and install the
rsuite
client in your machine. - Install the R package with
rsuite install
- Clone this repo
- From the project root
r4ds-rsuite
, open a terminal, and runRscript R/compile_book.R
. The book will start building. - Run the bookdown or
gitbook
version ofr4ds
by runningindex.html
under the folderwork/r4ds/_book
You will notice that the folder deployment/libs
has been populated only by the packages required by r4ds
. The operation is the same for any of the operating systems. The R binaries are generated depending of the OS.
I like the idea behind rsuite
. What I showed above is only one of the things that you can do with it. Additionally, you can:
- Put several packages under a main
umbrella
project to manage all of them, including tests and builds. - Generate a stand-alone
Python
from Anaconda inside thersuite
project. This is a pretty neat idea for distributing ready-to-run applications, because if you share with other users, they don't even need to install Python; only R is needed. - Create a local copy of a whole remote repository, for instance
CRAN
, or selected packages, in you own server, Amazon instance, or your local drive. This is pretty handy when you are working in location with poor or slow internet, or no connection at all. - Build a distributable R application as a
zip
file, where your users don't need to install any packages. Unpack it and run it with R. - You can also deploy the R application within a
Docker
container as well. So, instead of sending to your users a zip file, you send them a link to download a Docker container including R itself. - There are few other things that
rsuite
does but haven't tested or explored yet. But the whole concept is pretty neat, preparing you for deployment.