Running a Shiny web application

In order to run a Shiny web application, it is important to consider that UI.R, server.R, and, if needed, global.R must be placed in the same folder. If an HTML document is used, a folder named www must be created in the application folder to hold the HTML document. Additionally, it must be named index.html.

There are three basic ways to run the applications. They are as follows:

  • runApp(): This opens a browser and executes the application locally. It receives a string representing a directory as an argument. If no argument is provided, runApp() defaults to the working directory.
  • runGist()/runGitHub(): This works exactly as runApp(), but instead of looking for the files locally, it connects to a gist or a GitHub repository, downloads the full application in a temporary file, and displays it in a web browser. This is explained in more detail in Chapter 10, Sharing Applications.
  • URL: The web application is accessible to anyone that has the URL where it is located. In this case, it is not necessary for the application users to have R or RStudio on their computers. In order to have this, a server with rstudio-server and shiny-server installed is needed. Although the configuration of a public application is more complex than running it locally, it is definitely the most useful one as it enables access to almost any public application as only a web browser is needed. We will see more on this in Chapter 10, Sharing Applications.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset