title: Shiny and twitter example
body: <p>I'm trying to run a example to process tweets in R with Shiny. I'm using the example in <a href="https://hernanresnizky.com/2013/02/21/social-media-monitoring-tools-in-r-with-just-a-few-lines/" rel="nofollow noreferrer">this</a> page, but I'm not getting any output.</p>
  
  <p>The code that I'm using is as follows (which I've corrected from the page as it had some errors with parenthesis, inverted comas, etc.):</p>
  
  <p>ui.r</p>
  
  <pre><code>library(shiny)
  shinyUI(pageWithSidebar(
    # Application title
    headerPanel('Tweets hunter'),
    sidebarPanel( textInput('term', 'Enter a term', ''),
                  numericInput('cant', 'Select a number of tweets',1,0,200),
                  radioButtons('lang','Select the language',c(
                    'English'='en',
                    'Castellano'='es',
                    'Deutsch'='de')),
                  submitButton(text='Run')),
    mainPanel(
      h4('Last 5 Tweets'),
      tableOutput('table'),
      plotOutput('wordcl'))
  ))
  </code></pre>
  
  <p>server.r</p>
  
  <pre><code>library(shiny)
  library(twitteR)
  library(wordcloud)
  library(tm)
  shinyServer(function (input, output) {
    rawData &lt;- reactive(function(){
      tweets &lt;- searchTwitter(input$term, n=input$cant,lang=input$lang)
      twListToDF(tweets)
    })
    output$table &lt;- reactiveTable(function () {
      head(rawData()[1],n=5)
    })
    output$wordcl&lt;- reactivePlot(function(){
      tw.text&lt;-enc2native(rawData()$text,
                          tw.text &lt;- tolower(tw.text),
                          tw.text &lt;- removeWords(tw.text,c(stopwords(input$lang),'rt')),
                          tw.text &lt;- removePunctuation(tw.text,TRUE),
                          tw.text &lt;-unlist(strsplit(tw.text,' ')),
                          word&lt;- sort(table(tw.text),TRUE),
                          wordc&lt;-head(word,n=15),
                          wordcloud(names(wordc),wordc,random.color=TRUE,colors=rainbow(10),scale=c(15,2))
      )
    })
  })
  </code></pre>
  
  <p>I've edited the code of the server.r file as some of the commands are deprecated as follows:</p>
  
  <pre><code>library(shiny)
  library(twitteR)
  library(wordcloud)
  library(tm)
  shinyServer(function (input, output) {
    rawData &lt;- reactive(function(){
      tweets &lt;- searchTwitter(input$term, n=input$cant,lang=input$lang)
      twListToDF(tweets)
    })
    #output$table &lt;- reactiveTable(function () {
    #  head(rawData()[1],n=5)
    #})
    output$filetable &lt;- renderTable( 
      { if (is.null(input$files)) { # User has not uploaded a file yet 
        return(NULL) } 
        head(rawData()[1],n=5) })
  
    #http://shiny.rstudio.com/reference/shiny/latest/renderPlot.html
    #  output$wordcl&lt;- reactivePlot(function(){
    #  tw.text&lt;-enc2native(rawData()$text,
    #                      tw.text &lt;- tolower(tw.text),
    #                      tw.text &lt;- removeWords(tw.text,c(stopwords(input$lang),'rt')),
    #                      tw.text &lt;- removePunctuation(tw.text,TRUE),
    #                      tw.text &lt;-unlist(strsplit(tw.text,' ')),
    #                      word&lt;- sort(table(tw.text),TRUE),
    #                      wordc&lt;-head(word,n=15),
    #                      wordcloud(names(wordc),wordc,random.color=TRUE,colors=rainbow(10),scale=c(15,2))
    #  )
    #})
  
    output$wordcl&lt;- renderPlot(
        function(){
          tw.text&lt;-enc2native(rawData()$text)
                              tw.text &lt;- tolower(tw.text)
                              tw.text &lt;- removeWords(tw.text,c(stopwords(input$lang),'rt'))
                              tw.text &lt;- removePunctuation(tw.text,TRUE)
                              tw.text &lt;-unlist(strsplit(tw.text,' '))
                              word&lt;- sort(table(tw.text),TRUE)
                              wordc&lt;-head(word,n=15)
                              wordcloud(names(wordc),wordc,random.color=TRUE,colors=rainbow(10),scale=c(15,2))
        }
                              ,width = "auto", height = "auto", res = 72, 
                 env = parent.frame(), quoted = FALSE, execOnResize = FALSE,
                 outputArgs = list())
  
  })
  </code></pre>
  
  <p>But I'm not getting any output</p>
  
  <p>Any ideas what is causing I'm missing?</p>
  
  <p>Thanks</p>