server.R中的input$goButton
是由actionButton
触发的,应该是在RStudio Shiny中的if
语句之内?在闪亮的网页的例子显示:RStudio Shiny actionButton ignored
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Click the button"),
sidebarPanel(
sliderInput("obs", "Number of observations:",
min = 0, max = 1000, value = 500),
actionButton("goButton", "Go!")
),
mainPanel(
plotOutput("distPlot")
)
))
和
library(shiny)
shinyServer(function(input, output, message) {
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, main=isolate(paste(system(paste("echo", dist[1],"> /tmp/1 && md5sum /tmp/1"),intern=TRUE),collapse='')))
})
})
我有一个稍微复杂的程序更语句上面的例子中,并在用户点击前的事件发生事件去按钮。这使得我认为input$goButton
被忽略时,其中的一个语句是R system()
调用。
Shiny Server v1.1.0.10000
Node.js v0.10.21
packageVersion: 0.10.0
任何想法?
这表明依赖是ON语句goButton,因为它在反应表达式内。通过这种方式来看,如果你想依赖你的按钮,只需在你的反应表达式中输入$ goButton,每次点击它时,反应表达式都会被执行。 – 2014-10-02 16:41:16
在我更复杂的例子中,我有一堆'isolate()'调用。这可能是它在goButton之前被触发的原因吗?我可以在被动调用中使用多个'isolate()'吗? – 719016 2014-10-03 08:55:12
提供你的例子,那么我将能够看到什么确切的问题来源 – 2014-10-03 14:36:54