Shiny Cheat Sheet

In R, Shiny

Introduction

Shiny is a web application framework for R, a popular programming language used for statistical computing and data analysis. It allows users to create interactive web applications and dashboards without the need for extensive web development knowledge.

With Shiny, users can easily create web applications that allow for data visualization, data exploration, and data analysis. The framework provides a variety of tools and widgets that can be used to create interactive plots, tables, and other visualizations.

One of the key benefits of Shiny is its ability to integrate with other R packages, allowing users to leverage the power of R’s statistical and data analysis capabilities. This makes it an ideal tool for data scientists, analysts, and researchers who want to share their work with others in an interactive and engaging way.

Basic Structure

ElementDescription
uiThe user interface of the application
serverThe server-side logic of the application
shinyAppThe function that creates the Shiny application

User Interface

Layouts

ElementDescription
fluidPageA fluid layout that adjusts to the size of the browser window
fixedPageA fixed layout with a fixed width
navbarPageA layout with a navigation bar at the top
sidebarLayoutA layout with a sidebar and a main panel
splitLayoutA layout with two or more panels that can be resized

UI Components

ElementDescription
actionButtonA button that triggers an action
checkboxInputA checkbox that can be checked or unchecked
dateInputA date picker
fileInputA file upload button
numericInputA numeric input field
radioButtonsA set of radio buttons
selectInputA dropdown menu
sliderInputA slider
submitButtonA button that submits a form
textInputA text input field

Output Components

ElementDescription
plotOutputA plot
tableOutputA table
verbatimTextOutputText output
htmlOutputHTML output
imageOutputAn image

Server-Side Logic

Reactive Programming

ElementDescription
reactiveA function that creates a reactive object
observeA function that observes a reactive object and triggers an action
eventReactiveA function that creates a reactive object that is triggered by an event
isolateA function that isolates a reactive object from other reactive objects

Data Manipulation

ElementDescription
renderPlotA function that renders a plot
renderTableA function that renders a table
renderTextA function that renders text
renderUIA function that renders UI components
reactiveValuesA function that creates a reactive object that can be modified

Session Management

ElementDescription
sessionAn object that represents the current session
stopA function that stops the current session
invalidateLaterA function that invalidates a reactive object after a certain amount of time
reactiveTimerA function that creates a reactive object that triggers after a certain amount of time

Conclusion

This cheat sheet provides an overview of the basic elements of Shiny, including the user interface, server-side logic, and reactive programming tools. With this knowledge, you can start building your own interactive web applications using R and Shiny.

Reference:

https://shiny.rstudio.com/

# #