ui = fluidPage(selectInput(inputId = "mySelection",
label = h3("Select box"),
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1),
verbatimTextOutput( outputId = "myOutput")
)
server = function(input, output) {
output$myOutput = renderPrint({
paste(paste("This is my choice"), input$mySelection)
})
}
shinyApp(ui, server)- 1
- Define the ID of the input in the UI (internal use)
- 2
- Define the label of the element (external use)
- 3
- Options (labels) and their internal labels
- 4
- Default selected option
- 5
- Define the label (internal use) of the outuput in the UI (where the results elaborated by the server will be stored)
- 6
- Function in the server to render the results (consistent with the UI definition)
- 7
- Call for the label of the input in the UI