Shiny (in R)
What is Shiny (R)?
The Shiny web framework fundamentally enables collecting input values from a web page, making those inputs easily available to the application in R, and having the results of the R code written as output values to the web page. In its simplest form, a Shiny application requires a server function to do the calculations and a user interface. Shiny applications have two components, a user-interface definition and a server script.
Shiny Application Example
Source: R Studio
Shiny comes with a reactive programming library that you use to structure your application logic. By using this library, changing input values will naturally cause the right parts of your R code to be re-executed, which will in turn cause any changed outputs to be updated. The reactive programming model eliminates the need for additional event handling code.
In Shiny, there are three kinds of objects in reactive programming: reactive sources, reactive endpoints, and reactive conductors.
- Reactive sources and endpoints: The simplest structure of a reactive program involves just a source and an endpoint. In a Shiny application, the source typically is user input through a browser interface. For example, when the selects an item, types input, or clicks on a button, these actions will set values that are reactive sources. A reactive endpoint is usually something that appears in the user’s browser window, such as a plot or a table of values.
- Reactive conductors: It’s possible to put reactive components in between the sources and endpoints. Reactive conductors can be useful for encapsulating slow or computationally expensive operations.
Starting out with Shiny
You can install Shiny the usual way from your R console: