Catalog / Shiny Cheat Sheet
Shiny Cheat Sheet
A comprehensive cheat sheet covering essential Shiny concepts, functions, and best practices for building interactive web applications with R.
Core Concepts
Basic Structure
A Shiny app consists of two main parts: a user interface (
|
The |
The |
UI Elements
|
Creates a fluid layout that adapts to different screen sizes. |
|
Creates a layout with a sidebar and a main panel. |
|
Contains the elements in the sidebar. |
|
Contains the main content of the app. |
|
Adds a title to the page. |
|
Adds a line break. |
Reactivity
Shiny uses a reactive programming model. When an input value changes, Shiny automatically re-executes the code that depends on that value. |
|
|
|
Input Components
Common Input Widgets
|
Creates a text input box. |
|
Creates a numeric input box with optional min, max, and step. |
|
Creates a slider input. |
|
Creates a dropdown select box. |
|
Creates a set of radio buttons. |
|
Creates a group of checkboxes. |
|
Creates a single checkbox. |
|
Creates a date input. |
|
Creates a file upload input. |
Output Components
Rendering Outputs
|
Renders a plot (e.g., from |
|
Renders a static table (e.g., from a data frame). |
|
Renders an interactive table (using DataTables library). |
|
Renders text output. |
|
Renders the output of |
|
Renders arbitrary HTML or Shiny UI elements. Useful for dynamic UIs. |
Displaying Outputs in UI
|
Displays a plot rendered by |
|
Displays a table rendered by |
|
Displays an interactive table rendered by |
|
Displays text rendered by |
|
Displays text (verbatim) rendered by |
|
Displays UI elements rendered by |
Advanced Features
Download Handlers
Use
|
Session Management
The
|
JavaScript Integration
You can integrate JavaScript code into your Shiny apps using
|
Modules
Shiny modules allow you to encapsulate UI and server logic into reusable components. This promotes code organization and reusability.
|