My super awesome Shiny app looks like this:
library(shiny)
ui <- fluidPage(
numericInput(inputId = "A", label = "A", value = 5, step = 1),
uiOutput("slider"),
textOutput(outputId = "value")
)
server <- function(input, output) {
output$value <- renderText(paste0("A + B = ", input$A + input$B))
output$slider <- renderUI({
sliderInput(inputId = "B", label = "B", min = 0, max = 2*input$A, value = 5)
})
}
shinyApp(ui = ui, server = server)
The sliderInput for B is dynamic (S/O to HubertL & BigDataScientist) but now I need to protect the input for A from negative numbers.
How might I accomplish this?
min
value innumericInput
, for exnumericInput(inputId = "A", label = "A", value = 5, step = 1,min=0)
– NicE