inst/Conditionalwidgets/shinywidget.R

## Only run this example in interactive R sessions
if (interactive()) {
  shinyApp(
    ui = fluidPage(
      sidebarLayout(
        sidebarPanel(
          p("The first slider controls the second"),
          sliderInput("control", "Controller:", min=0, max=20, value=10,
                      step=1),
          sliderInput("receive", "Receiver:", min=0, max=20, value=10,
                      step=1)
        ),
        mainPanel()
      )
    ),
    server = function(input, output, session) {
      observe({
        val <- input$control
        # Control the value, min, max, and step.
        # Step size is 2 when input value is even; 1 when value is odd.
        updateSliderInput(session, "receive", value = val)
      })
    }
  )
}
MATHSTATSOU/Intro2MLR documentation built on Dec. 11, 2020, 9:01 p.m.