MCVE's should start the Shiny app when they are copied in the console. An easy way to do this is using the shinyApp
function. For example:
why is my checkbox not responding?
library(shiny)
ui <- fluidPage(
checkboxInput('checkbox', 'click me'),
verbatimTextOutput('text')
)
server <- function(input, output, session){
output$text <- renderText({
isolate(input$checkbox)
})
}
shinyApp(ui, server)
Alternatively, you can also not assign variables to ui
and server
.
library(shiny)
shinyApp(
fluidPage(
checkboxInput('checkbox', 'click me'),
verbatimTextOutput('text')
),
function(input, output, session){
output$text <- renderText({
isolate(input$checkbox)
})
}
)
shinyApp(ui, server)