In developing SkyScorer I've sought ways to package it as a standalone Windows app. The advantages of doing this is quite clear:

  • The end-user doesn't need any R knowledge to run the app
  • The app can be distributed as a simple download
In this tutorial I will go through the process that is needed to create a standalone Windows Shiny app.

Portable R & Chrome

Firstly download Portable R and Portable Chrome. These will serve as the backbone of our app. Essentially, we are packing along with our app self-contained copies of R and Chrome:
  • Portable R:
  • Portable Chrome:
Once you have downloaded the installation files for Portable R and Portable Chrome just install them and note down their installation path. We will use this later.

For simplicity I will assume you can make a folder in your C Drive called YourApp, but the folder could be situated anywhere. Now copy the portable R installation and the Portable Chrome installation into the C:\YourApp folder. Also copy your Shiny folder containing server.R and ui.R (or a sole app.R in the case of single file Shiny app) into the folder. So now you should have three folders in your C:\YourApp directory
  • C:\YourApp\GoogleChromePortable
  • C:\YourApp\R-Portable
  • C:\YourApp\Shiny

Setting Up Portable R

Just run R-Portable.exe and install all the libraries that are needed by your Shiny app. They will be stored in the Portable R folder. 

Setting Up Portable Chrome

Make sure you have the following line in the GoogleChromePortable.ini file which is in the GoogleChromePortable folder

AdditionalParameters= --app="http://localhost:8888"

The additional parameter there makes Chrome start up in app model (i.e. with address bar, bookmarks etc) which makes it look more like a native app.

The .bat and .vbs files

In the C:\YourApp folder create two files
  • run.vbs
  • runShinyApp.R

The contents
Now WAIT! Don't click on run.vbs just yet! I advise you to add the following to the server.R inside the shinyServer(function(input, output, session)  { ... }). Please make sure you pass session as the third argument! The code you need to add is 

This will close the Rsession when you close the browser (in this case Portable Chrome). Now clicking on run.vbs should start your app!

Simply zip up your folder C:\YourApp and distribute! Your users need only double click on run.vbs to run the app.

If you want to appear more professional you can follow the instruction in the next section to create a setup.exe file for you app.


Download InnoSetup and install the software and run the Wizard for creating a new setup file. Everything should be pretty self-explanatory, just make sure that InnoSetup knows to use the C:\YourApp directory. Basically InnoSetup will package everything in the directory into an .exe file which acts as a setup wizard.

I chose my default install path to be somewhere other than C:\Program Files as I have found a few issues with it on Windows 8 (no problem on Windows XP).

Once you are done with the InnoSetup Wizard you should end up with a .iss file looking like this 

The code in the .iss file should be self-explanatory. I only added a few lines which I thought was helpful. Under [setup] add PrivilegesRequired=none, this will not request for admin privilege when installing the app so should allow the app to be installed by most users. Also I created a shortcut to the desktop using the below

Name: "{commondesktop}\YourApp"; Filename: "{app}\Apps\run.vbs"; IconFilename: {app}\Your.ico

Of course I have my own custom .ico file to make the shortcut look unique and professional.

Hope this helps!


17 March 2014


blog comments powered by Disqus