title: R - Trycatch is saving warning instead of returning function output
body: <p>I am trying to download records from twitter using <code>rtweet</code>. One issue with this is the twitter server needs to wait 15minutes every 18000 records. So, after record number 18000, I receive a data frame with all the records and a nice warning telling me to wait for a bit. <code>search_tweets</code> has an function argument to download more than 18000 records called <code>retryonratelimit</code>. However, this isnt working so I am exploring other options. </p>
  
  <p>I have produced a function, incorporating <code>tryCatch</code> to address this. However, when the warning at 18000 records pops up, tryCatch is saving the warning rather than the data frame which should be spit out before the warning. Something it would not do if 17999 records were downloaded</p>
  
  <pre><code>library(rtweet)
  library(RDCOMClient)
  library(profvis)
  
  TwitScrape = function(SearchTerm){
    ReturnDF = tryCatch({
      TempList=NULL
      Temp = search_tweets(SearchTerm,n=18000)
      TempList = list(as.data.frame(Temp), SearchTerm)
      return(TempList)
      },
      warning = function(TempList){
        Comb=NULL
        MAXID = min(TempList[[1]]$status_id)
        message("Delay for 15 minutes to accommodate server download limits")
        pause(901)
        TempWarn = search_tweets(TempList[[2]],n=18000, max_id=MAXID)
        TempWarn = as.data.frame(TempWarn)
        Comb = rbind(TempList[[1]], TempWarn)
        CombList = list(Comb, TempList[[2]])
        return(CombList)
      }
        )
    }
  
  Searches = c("#MUFC","#LFC", "#MCFC")
  TestExpandList=NULL
  TestExpand=NULL
  TestExpand2=NULL
  for (i in seq_along(Searches)){
    TestExpandList = TwitScrape(SearchTerm =  Searches[i])
    TestExpand = TestExpandList[[1]]
    TestExpand$Cat = Searches[i]
    TestExpand$DownloadDate = Sys.Date()
    TestExpand2 = rbind(TestExpand2, TestExpand)
  }
  </code></pre>
  
  <p>I hope this makes sense. If I can offer any more information please let me know.  In summary, why is <code>tryCatch</code> saving my warning rather than the data frame I want?</p>