I have a basic shiny app that evaluates A + B:
library(shiny)
ui <- fluidPage(
numericInput(inputId = "A", label = "A", value = 5, step = 1),
sliderInput(inputId = "B", label = "B", min = 0, max = 10, value = 5),
textOutput(outputId = "value")
)
server <- function(input, output) {
output$value <- renderText(paste0("A + B = ", input$A + input$B))
}
shinyApp(ui = ui, server = server)
A is a numericInput value and B is a sliderInput value.
I want to constrain my app so that the maximum input value for B is always 2 * A. I, therefore, must change the hardcoded max = in sliderInput to something that can be dynamic. How can I accomplish this?
Thanks