R Shiny - prevent the app from plotting on start?

大城市里の小女人 提交于 2020-01-17 06:47:03

问题


How can I prevent shiny from plotting any data on load/ start?

For instance from this example,

shinyUI(pageWithSidebar(
  headerPanel("Click the button"),
  sidebarPanel(
    sliderInput("obs", "Number of observations:",
                min = 0, max = 1000, value = 500),
    actionButton("goButton", "Go!")
  ),
  mainPanel(
    plotOutput("distPlot")
  )
))

shinyServer(function(inhttps://shiny.rstudio.com/articles/isolation.htmlput, output) {
  output$distPlot <- renderPlot({
    # Take a dependency on input$goButton
    input$goButton

    # Use isolate() to avoid dependency on input$obs
    dist <- isolate(rnorm(input$obs))
    hist(dist)
  })
})

Shiny will plot the data as soon as the app is started. But I don't want it to plot until the button is clicked.

Any ideas?

来源:https://stackoverflow.com/questions/44311869/r-shiny-prevent-the-app-from-plotting-on-start

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!