R Future Error:尝试在NULL上设置属性

时间:2017-07-28 23:25:18

标签: r shiny future

我想从将来更新SelectizeInput,但我收到此错误:

"尝试在NULL"

上设置属性

以下是一个例子:

library(shiny)
library(future)

plan(transparent)

ui <- fluidPage(# client side selectize
  selectizeInput("currentCountry", "Countries : ", choices = NULL))


server <- function(input, output, session) {
  repeat {
    countriesFuture <- future({
      rtweet::stream_tweets(timeout = 20)
    })
    updateCountries <- future({
      worldTweets<- value(countriesFuture)
      updateSelectizeInput("currentCountry",
                           "New Countries : ",
                           choices = worldTweets$country)
    })
  }
}

shinyApp(ui, server)

1 个答案:

答案 0 :(得分:0)

我猜您需要将会话添加到updateSelectizeInput,所以它变为如下:  updateSelectizeInput(session, "currentCountry", choices = worldTweets$country)