Shiny is an R package that makes it easy to build interactive web apps straight from R.
You can host
I highly recommend you to visit https://shiny.rstudio.com/ for the documentation and gallery.
There are multiple way to host a shiny app.
There are couple ways to create an shiny app (we are going to focus on RStudio).
flexdashboard
was installed.)ui <- fluidPage(
# controls the layout and content of the application
)
server <- function(input, output) {
# controls the interaction, modify output based on user input
}
# run the application
shinyApp(ui = ui, server = server)
We are going to use the tutorial in https://github.com/rstudio-education/shiny.rstudio.com-tutorial
Input |
---|
checkboxInput |
dateInput |
dateRangeInput |
fileInput |
numericInput |
selectInput |
varSelectInput |
sliderInput |
textInput |
textAreaInput |
passwordInput |
Output | Render |
---|---|
uiOutput | renderUI |
imageOutput | renderImage |
plotOutput | renderPlot |
tableOutput | renderTable |
dataTableOutput | renderDataTable |
textOutput/verbatimTextOutput | renderText/renderPrint |
Reactivity maybe the most challenging part of learning shiny!
reactive()
observe()
and observeEvent()
eventReactive()
isolate()
reactiveVal()
and reactiveValues()
req()
and need()