问题
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