fatma
2024-12-17
Shiny is an R package that makes it easy to build interactive web applications (apps) straight from R. Shiny is an R package developed by RStudio that allows you to create interactive web applications directly from R. It is widely used for building dashboards, data visualizations, and other interactive tools that can be used both locally and in a web-based environment.
How Shiny Works: Shiny is reactive, meaning that when a user changes an input, the app will automatically update the outputs that depend on it. This reactivity is powered by the reactive programming paradigm, which Shiny handles for you behind the scenes.
Reactive Inputs: These are user inputs like sliders, text boxes, or drop-down menus. The app will respond to changes in these inputs.
Reactive Outputs: These are the outputs displayed on the app, such as text, tables, or plots. They are dynamically updated when the corresponding inputs change.
Reactive Expressions: These are pieces of code that depend on inputs and automatically re-execute when the inputs change. For example, a plot that updates every time a slider changes.
Example of a Simple Shiny App:
## Warning: package 'shiny' was built under R version 4.4.2
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00