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 result of 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.

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 the configuration section in the appendix.

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.

Server log messages related to this component can be shown by enabling the launcher region. More information about activating log regions is in the configuration appendix.

R Configuration

You can optionally 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

Replace /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.

Note

R must be configured in order for the Job Launcher to work correctly. For more information, refer to the Job Launcher section.

If the RVersion field is included, then it must be valid, and it must only appear once in the configuration file. Check the server log after starting and stopping the RSPM process for messages relevant to the R configuration.

R Installation

RStudio recommends that in most cases you install R from pre-compiled binaries. This gives you the benefit of:

  • Side-by-side installation of multiple versions of R
  • It is quick, since the compilation step has previously been completed

To install from pre-compiled binaries, follow the instructions at Install R.

Alternatively, you can install R from source, to do this follow the instructions at Install R from source.

Process Management

See the process management section for information on how RStudio Package Manager securely runs R processes when building R packages for git sources.