title: User lookup on Twitter API from R results in error (403)
body: <p>Using the Twitter API and the <code>twitteR</code>-package, I am trying to retrieve the user objects 
  for a long list of names (between 50.000 and 100.000).</p>
  
  <p>I keep getting the following error:</p>
  
  <pre><code>Error in twInterfaceObj$doAPICall(paste("users", "lookup", sep = "/"),  : 
    client error: (403) Forbidden
  </code></pre>
  
  <p>The error code supposedly hints at <a href="https://dev.twitter.com/docs/error-codes-responses">"update limits"</a>.
  But the <a href="https://dev.twitter.com/docs/rate-limiting/1.1/limits">rate limit on user lookups</a> is 180 and lookups are performed in <a href="https://dev.twitter.com/docs/api/1.1/get/users/lookup">batches of 100</a> user names. 
  Therefore up to 18.000 users shouldn't be a problem. But even reducing the number to 6000 (to respect the limit on requests via application-only auth) per 15 minute time window results in the same error.</p>
  
  <p>Here is a MWE (for which you do, however, need <a href="http://alstatr.blogspot.de/2014/03/r-text-mining-on-twitter-prayformh370.html">your own API-keys</a>):</p>
  
  <pre><code>library(plyr)
  # install the latest versions from github:
  # devtools::install_github("twitteR", username="geoffjentry")
  # devtools::install_github("hadley/httr")
  library(twitteR)
  library(httr)    
  
  source("TwitterKeys.R") # Your own API-Keys
  setup_twitter_oauth(consumerKey, consumerSecret, accessToken, accessSecret)
  
  # The following is just to generate a large enough list of user names:
  searchTerms &lt;- c("worldcup", "economy", "climate", "wimbledon", 
                   "apple", "android", "news", "politics")
  
  # This might take a while
  sample &lt;- llply(searchTerms, function(term) {
    tweets &lt;- twListToDF(searchTwitter(term, n=3200))
    users &lt;- unique(tweets$screenName)
    return(users)
  })
  
  userNames &lt;- unique(unlist(sample))
  
  # This function is supposed to perform the lookups in batches 
  # and mind the rate limit:
  getUserObjects &lt;- function(users) {
    groups &lt;- split(users, ceiling(seq_along(users)/6000))
    userObjects &lt;- ldply(groups, function(group) {
      objects &lt;- lookupUsers(group)
      out &lt;- twListToDF(objects)
      print("Waiting for 15 Minutes...")
      Sys.sleep(900)
      return(out)
    })
    return(userObjects)
  }
  
  # Putting it into action:
  userObjects &lt;- getUserObjects(userNames)
  </code></pre>
  
  <p>Sometimes looking up smaller subsets manually e.g. via <code>lookupUsers(userNames[1:3000])</code> works; when I try to automate the process, however, the error gets thrown.</p>
  
  <p>Does anyone have an idea what the reason for this might be?</p>