I am trying to code a simple example where i can change reactive sources, not by mouse interaction but by changing into R code the value of that reactive source.
Here is a working example:
ui.R :
# coming from 001-helloworld example....
library(shiny)
shinyUI(fluidPage(
titlePanel("Hello Shiny!"),
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
mainPanel(
plotOutput("distPlot")
)
)
))
server.R :
library(shiny)
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
x <- faithful[, 2] # Old Faithful Geyser data
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
})
I want to be able to access and change "bins" in R code and make the graph react to that (not using the mouse).
EDIT: To clarify, the change in bins should be produced in R code in runtime (once the shiny "app" is running). So, it is like "replacing" the mouse interaction with "code in runtime" interaction.
Is there a way to do it? I am mostly sure to miss some obvious point here... sorry .
Thanks.