CHAPTER 26
Beginner
R Shiny Basics
Updated: May 18, 2026
5 min read
# CHAPTER 26
R Shiny Basics
1. Chapter Introduction
Shiny turns R analyses into interactive web applications — no HTML, CSS, or JavaScript required. Executives can filter their own data; analysts can share insights without emailing static reports. This chapter builds a complete interactive analytics dashboard.2. Shiny Architecture
text
3. Basic Shiny App
r
4. Common Mistakes
-
Calling
filtered()multiple times in server: Each call re-executes the reactive. Store result:df <- filtered()then usedfmultiple times — or the reactive handles caching automatically.
-
Heavy computation inside
render*(): Move expensive operations intoreactive()so they run once and are shared. Never put database queries directly inside render functions.
5. MCQs
Question 1
Shiny ui defines?
Question 2
reactive() in server creates?
Question 3
renderPlot() produces?
Question 4
observeEvent(input$btn, {...}) fires?
Question 5
downloadHandler() creates?
Question 6
Shiny requires?
Question 7
filtered()$revenue (with parentheses) is because?
Question 8
DT::renderDataTable() creates?
Question 9
updateSelectInput() changes?
Question 10
Shiny app is deployed to production via?
6. Interview Questions
- Q: How does Shiny's reactive system work?
- Q: Where would you host a Shiny app for production use?
7. Summary
Shiny:ui (HTML layout) + server (reactive logic). Input widgets: selectInput, sliderInput, dateRangeInput. Outputs: renderPlot() + plotOutput(), renderTable() + tableOutput(). Reactivity: reactive() caches computations, auto-updates when inputs change. observeEvent() for button clicks. Deploy: shinyapps.io (free), Posit Connect (enterprise). Add DT::dataTableOutput() for searchable tables.