【发布时间】:2017-10-30 07:35:55
【问题描述】:
我在 R 中的闪亮服务器中遇到反应输出问题。
我想要做的是创建一个使用基于输入计算的值的情节图。
只有在我单击提交/完成按钮后才需要更新输出,并且必须根据需要多次计算输出。
我设法做的是独立于提交按钮更新内容(提交按钮根本没有功能),并且在我更改 1 个值后,情节立即发生了变化。
我想做的是只有在我指定了我想要的所有参数值之后才更改绘图。
这是我的 ui.R 代码的最小示例:
shinyUI(fluidPage(
titlePanel("Wages in Year 2016 for Czech Republic in CZK"),
sidebarPanel(
conditionalPanel(condition = "input.conditionedPanels==7",
selectInput("Age", "Age", choices = vek_mod$Vek, selected = "23-27"),
selectInput("ChosenSex", "Your sex", choices = pohlavi_mod$Pohlavie, selected = "Zena"),
actionButton("Button", "Done"),
p("Click so changes will take effect.")
),
mainPanel(
tabsetPanel(
...
tabPanel("Minimal_Example", textOutput("Minimal_Example"), value = 7)
...
, id = "conditionedPanels"
)
)
)
)
这里是 server.R 代码:
...
output$Minimal_Example <- renderPrint({
Age <- input$Age
Sex <- input$ChosenSex
c(Age, Sex)
})
...
我用 observeEvent() 和 eventReactive() 尝试了很多东西,但到目前为止没有任何效果。
如果您想查看代码的行为方式,请查看此处: http://52.59.160.3:3838/sample-apps/Mzdy_ShinyApp/
标签被称为 Minimal_Example
谢谢
【问题讨论】:
-
考虑使用
submitButton而不是actionButton