A framework for deploying self-contained R-based applications to the desktop
Allows developers to share R based applications to users as desktop applications by providing both a portable R executable environment and a private application package library.
For more information on how this framework was developed please read:
Develop an Application
This deployment strategy has been tested with R based applications developed with Shiny, RGTK, and Tcl/Tk UIs. The specifics of how to make applications with each of these frameworks are beyond the scope of these instructions.
Clone this repository
cd /path/to/deployment/staging git clone https://github.com/wleepang/DesktopDeployR.git MyApplication
git clone command above will clone the framework into a folder named
Alternatively, you can fork this repository into your own Github account and clone from there.
Create a branch for your app
It is highly recommended that you create a branch for your application:
cd /path/to/MyApplication git checkout -b MyApplication
This will allow you to easily track your application code and any customizations you make to the framework.
"Install" R-Portable into the framework
The framework can be used with both a system installed version of R or R-Portable. The latter is recommended as it provides the most application isolation and allows for applications to be deployed to users unable to install R on their own (i.e. they lack sufficient system privileges).
Download R-portable from: https://sourceforge.net/projects/rportable/
Install it into:
Customize the framework for your application
Install application scripts / assets
For example - a shiny app:
- create a folder called
server.R, and any other related files into
# assuming all shiny app code (ui.R and server.R are in ./app/shiny) shiny::runApp('./app/shiny')
Specify package dependencies
app/packages.txt - adding your app's primary package dependencies, one
package per line.
shiny app that depends on
app/packages.txt should look like:
jsonlite # required by DesktopDeployR shiny ggplot
Packages listed here, along with their dependencies, are installed in a private
application library (
app/library) when the application is run for the first
Note, the above only works for packages available on CRAN. Custom packages need
to be installed manually. The recommended method is to use
$ Rscript -e "devtools::install('path/to/package', lib = '<appname>/app/library')"
Configure application launch options
app/config.cfg is a JSON-ish formatted file that configures how the
application is launched. Block (
/* ... */) and line level (
// ...) comments
are allowed - they are removed to create valid JSON before the file is parsed.
Root level options:
||The name of the application. Displayed in the title of the progress bar shown during initialization, and used to name folders for logs based on logging settings (see below).|
Rename the application launching batch script file
appname.bat as appropriate - e.g. to
Deploy your application
The entire application folder is copied to the deployed location. This is the
easiest way to deploy. Note, it is possible to place / launch an application
from a network share. If this is the case, be sure to set
in the application launch configuration.
Create an installer using NSIS installer or InnoSetup. This is ideal for installing on isolated workstations. Both R-portable and package dependencies can be compiled with the installer. This means that a "first run" that ensures all package dependencies, must occur before compiling an installer.
TBD: an example InnoSetup installer compile script
Using a different (newer) version of R
./dist/R-Portable/ with the version of
R-Portable that is
required or modify
./app/config.cfg to point to the desired R installation
(e.g. a system install).
Due to their potentially large sizes, it is not recommended that the following folders be tracked by version control (i.e. Git):