在 Shiny 上嵌入 Twitter Timeline 时出错

Error while embedding Twitter Timeline on Shiny

我正在尝试解决这个问题:

How can I embed a twitter timeline in a Shiny app

这是我的代码:

library(shiny)
runApp(list(ui = fluidPage(
  tags$head(tags$script('!function(d,s,id){var js,fjs=d.getElementsByTagName(s)    [0],p=/^http:/.test(d.location)?\'http\':\'https\';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");')),
  titlePanel(""),
  sidebarLayout(
    sidebarPanel()
    , mainPanel(
      a("BreakingNews",class="twitter-timeline",href = "https://twitter.com/BreakingNews", "data-widget-id"="553910163694821376")     
               )
               )
 )
, server = function(input, output, session){

}
)
)

我收到这个错误:

Error in handlers$add(handler, key, tail) : Key / already in use

所以我稍微调整了代码,至少错误消失了。

library(shiny)
      shinyUI(fluidPage(
  tags$head(tags$script('!function(d,s,id){var js,fjs=d.getElementsByTagName(s)    [0],p=/^http:/.test(d.location)?\'http\':\'https\';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");')),
  titlePanel(""),
  sidebarLayout(
      sidebarPanel(),
      mainPanel(
      a("@ChannelNewsAsia",class="twitter-timeline",href="https://twitter.com/ChannelNewsAsia", "data-widget-id"=553910391399383040)     
               )
               )
 )
)

但现在屏幕只显示句柄名称,即@ChannelNewsAsia,点击它会将用户带到指定的 link。 ui

上仍然没有时间轴小部件出现