16 Building R Packages
R packages can come in multiple formats:
- Source: A collection of directories and files containing source code.
- Bundle: A specially created tar file containing bundled source code. The
R CMD build.
- Binary: A binary file specific to an operating system and architecture,
containing compiled source code. Not an executable. The result of
R CMD INSTALL.
In some configurations, RStudio Package Manager will need to run R in order to transform a package from one state to another. RStudio Package Manager uses the RStudio Job Launcher to perform this task.
Currently, the Job Launcher and R installation are only relevant if you use git sources.
16.1 Job Launcher
The RStudio Job Launcher is a service responsible for running jobs in support of
RStudio Package Manager. The Job Launcher is automatically installed when
RStudio Package Manager is installed. Settings for the Job Launcher can be
configured directly in the RStudio Package Manager configuration file,
/etc/rstudio-pm/rstudio-pm.gcfg, see A.
RStudio Package Manager can only use its own instance of the Job Launcher and runs all tasks locally. Other RStudio products may have separate Job Launcher instances managed independently from RStudio Package Manager. The RStudio Package Manager’s Job Launcher cannot be shared by other products, nor can RStudio Package Manager use a Job Launcher instance set up for another product.
16.2 R Configuration
The Job Launcher requires a valid installation of R. Any version of R
greater than 3.0.0 is sufficient. Specify the installation of R in the
RStudio Package Manager configuration file:
; /etc/rstudio-pm/rstudio-pm.gcfg [Server] RVersion = /opt/R/R-3.4.1
/opt/R/R-3.4.1 with the path to your R installation. Use the path to
the R installation directory, not the path to the binary (do not include
/bin/R). While multiple versions of R may be installed on the server, only
one version of R may be specified for use by RStudio Package Manager.
RVersion configuration option and an installation of R is not required,
however if the
RVersion field is included it must be valid and must only
appear once in the configuration file. Check the server log
after starting and stopping for messages relevant to the R
16.3 R Installation
We highly recommend installing R from source. Installing R from source makes it easy to manage multiple versions of R, prevents accidental upgrades of R, and ensures R is built with your architecture. For instructions on how to install R from source, see this article on installing R from source.
Alternatively, RStudio provides precompiled R binaries that may be installed side-by-side on supported Linux distributions. For instructions, see this article on installing R from precompiled binaries.
16.4 Process Management
See 18 for information on how RStudio Package Manager securely runs R processes when building R packages for git sources.