Case Studies: Building Web Applications with Shiny in R
Dean Attali
Shiny Consultant



ui <- fluidPage(
textInput(inputId = "name", label = "Enter your name",
value = "Dean"),
numericInput(inputId = "sibs", label = "How many siblings?",
value = 4, min = 0)
)
*Input(inputId, label, ...)inputId = Unique IDlabel = Text to describe input... = Additional input-specific parametersTwo steps:
Create placeholder for output (in UI)
ui <- fluidPage(
"Plot goes here:",
plotOutput(outputId = "my_plot")
)
Write R code to generate output (in server)
server <- function(input, output) {
# Code for building outputs
}
inputoutputui <- fluidPage( numericInput("num", "Number of rows", value = 10, min = 0), tableOutput("my_table") )server <- function(input, output) { output$my_table <- renderTable({ head(iris, n = input$num) }) }
renderPlot(), renderText(), etc)output$<outputId>input$<inputId> to access value of inputCase Studies: Building Web Applications with Shiny in R