Building Web Applications with Shiny in R
Kaelen Medeiros
Data Scientist
Shiny provides a variety of inputs to choose from.
selectInput("inputId",
"label",
choices = c("A", "B", "C"))
sliderInput("inputId",
"label",
value = 1925,
min = 1900,
max = 2000)
?dateRangeInput
help(checkboxInput)
ui <- fluidPage( textInput("name", "Enter a name:"), selectInput("animal", "Dogs or cats?", choices = c("dogs", "cats")), textOutput("greeting"), textOutput("answer") )
server <- function(input, output, session) { output$greeting <- renderText({ paste("Do you prefer dogs or cats,", input$name, "?") }) output$answer <- renderText({ paste("I prefer", input$animal, "!") }) }
Building Web Applications with Shiny in R