只有在多个人提交后,Shiny才能执行的最佳方式是什么?

时间:2017-11-15 23:17:10

标签: r shiny

我有一个有多个用户的闪亮程序。我已经在每个用户登录后编码成对。他们有一个值,当两者都是“准备好”时会更新

Participants[Group] <- list(
    Person1=list(Ready=FALSE, value=0),
    Person2=list(Ready=FALSE, value=0))

我希望我的代码只有在两个成员都提交了他们的输入后才能执行。例如,

ui.R

sliderInput("value",min=1,max=3)
actionButton("enter")

server.R

ReactParts <- reactiveValues()
ReactParts$Participants <- Participants

observeEvent( input$enter, {
    if( all( 
        sapply(Participants[Group], function(i){i$Ready == TRUE}) ) )
    {
        ReactParts$Participants[Group]$value <- input$value
    } ## else { do nothing}
})

处理组中所有个人的输入的最佳方法是点击enter

0 个答案:

没有答案