Hi all,
I want to barPlot the input values of 2 sliders in my shiny web app. As the original code is lengthy I included a shortened example of what I am trying to build below.
The bars in the chart are supposed to be the values of the sliderInputs S1 and S2, but for that I would need to include them as a vector which I can´t figure out how to do. The code as below returns the error "object input ID not found" instead of displaying the barplot.
As I just started with Shiny I am still trying to properly understand reactive(), so please excuse my rookie attempt.
Any hints would be greatly appreciated - thanks a lot!
library(shiny)
data <- reactive(c({input$S1; input$S2}))
ui <- fluidPage(
br(),
sliderInput(inputId = "S1", label= "S1", min = 1, max = 10, value = 5),
br(),
sliderInput(inputId = "S2", label= "S2", min = 1, max = 10, value = 5),
br(),
plotOutput("P1", width = "40vw")
)
server <- function(input, output) {
output$P1 <- renderPlot({
barplot(data(), horiz=TRUE, names.arg=c("S2", "S1"))
})
}
shinyApp(ui = ui, server = server)