0

I was trying the solution to this question:

How can I embed a twitter timeline in a Shiny app

This is my code :

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){

}
)
)

I am getting this error :

Error in handlers$add(handler, key, tail) : Key / already in use
Community
  • 1
  • 1
ruviansh
  • 105
  • 1
  • 3
  • 8
  • Please update shiny, you might be running an older version as you example works fine for me. I think this is a directory error – Pork Chop Jan 13 '15 at 08:47
  • @pops would you know why I am getting only the handle name and not the timeline along with it? – ruviansh Jan 14 '15 at 02:45

1 Answers1

0

So i tweaked the code a bit and at least the error disappeared.

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)     
               )
               )
 )
)

But now the screen only shows the handle name i.e @ChannelNewsAsia which on clicking takes the user to the specified link. There is still no timeline widget appearing on the ui

ruviansh
  • 105
  • 1
  • 3
  • 8
  • ok. so i published the same on the browser and works fine. Just the way I expect it to. Guess the shiny window is not the best place to test code locally. – ruviansh Jan 14 '15 at 03:01