The RStudio Shiny Server provides a way to publish your Shiny Apps for the Swarthmore community. Shiny Apps are web applications written in R. Users can code the application in RStudio and then copy them to the Shiny server for others to view.
To get started email email@example.com to request RStudio and Shiny server accounts.
Table of Contents
Copying Apps from RStudio Server to Shiny Server
Log into the RStudio Server site (rstudio.swarthmore.edu).
To copy Shiny apps from RStudio to Shiny, run the following command in the RStudio terminal (Tools menu → Terminal → New Terminal)
If my Swarthmore username is jsmith1 and my Shiny app is in the "histogram" folder in my home directory on RStudio, I would enter:
Viewing Shiny Apps
http://shiny.swarthmore.edu:3838/<username>/<foldername> to see the Shiny app running. The ":3838" is the server port that Shiny server uses.
In the example above, I would go to
You can see an example app at: http://shiny.swarthmore.edu:3838/ec2-user/hello/
The Shiny server is only available on the campus network or via VPN
Installing Packages on the Shiny Server
Most of the common R packages are already installed for all users on the Shiny server, but if you need a package that isn't installed, run the following command on the RStudio Server Terminal:
For example, if I wanted to install the ggploy2 package, I can run the following command
Can't copy files from RStudio to Shiny
Make sure that you use spaces as specified in the scp command. Don't add extra spaces or forget to add spaces.
If you have spaces in your file path, it can can confuse the scp command. There are three ways to deal with spaces:
- Put the path in quotes. For example,
scp -r "/home/jsmith1/my project/" shiny2:~/ShinyApps
- "Escape" the space by using a backslash. For example,
scp -r /home/jsmith1/my\ project/ shiny2:~/ShinyApps
- Remove the spaces in your folder names!
Errors in the Shiny App
Check the error messages provided. May need to install packages or copy all the files needed for your app.
Can't access the Shiny App
The Shiny server is only available on the campus network or via VPN.
Check to make sure the url you are using is correct. Don't forget the :3838 part or add additional spaces.
Explanation of the Copy Command
For those that are interested in the details
To copy a folder with the app from RStudio to Shiny, execute the following command:
scp -r <path to shiny app folder on RStudio> shiny:~/ShinyApps
Summary of the above command:
scp = secure copy (command to copy files from one computer to another)
-r = recursively copy all files within a directory
<path to shiny app folder on RStudio> = the directory on RStudio to copy to the Shiny server
shiny = shorthand for the Shiny server IP address
~/ShinyApps = the destination location on the Shiny server (shorthand for /home/<username>/ShinyApps)