Scoping, loading, and reusing data in Shiny applications

Although loading and reusing data in Shiny applications is covered in this chapter, because it is likely that these features would be used in a shinyapps.io-hosted application, much of it also applies to locally-run Shiny applications. If you use shinyapps.io, it will expect your application to be portable, that is, to avoid dependence on writing permanent changes to the local filesystem. This is because the application might be moved to another server for load-balancing purposes, rendering changes to the previous local filesystem inaccessible. You can write temporary files while a user is connected to the application (for example, if the user uploads their own data, this can be saved temporarily), but any changes made will be lost when the user exits.

Depending on the environment in which you are running and the task you are carrying out with your Shiny application, it is usually a good practice in most cases to make all Shiny applications portable. By making the application portable, you can not only seamlessly switch to shinyapps.io (even if it is just to share a beta version with colleagues using a free account), but it also means that the application is portable across other contexts; for example, if you distribute it via a .zip file, change your computer, or migrate the server on which you run Shiny Server. It is important, therefore, to understand the scoping of data within Shiny applications as well as the means of getting data in and out, both temporarily and permanently.

..................Content has been hidden....................

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