title: Is it possible to control the speed of the lapply function?
body: <p>I wrote a script to geocode a list of addresses using R and Google Maps, but it exceeds Google's 10 queries per second speed limit.  I would like to slow this down to 5 queries per second.</p>
  
  <p>My function constructs the URL, and then I call the functions using do.call, rbind, and lapply to create my geocoded dataset.</p>
  
  <pre><code>geoc &lt;- function(address){
      out &lt;- tryCatch({
        url &lt;- "http://maps.google.com/maps/api/geocode/json"
        response &lt;- GET(url,query=list(sensor="FALSE",address1=address))
        json &lt;- fromJSON(content(response,type="text"))
        loc &lt;- json$results[[1]]$geometry$location
        return(c(address1=address, long=loc$lng, lat=loc$lat))
        })
      return(out)
      } 
  
  result &lt;- do.call(rbind,lapply(as.character(sample$location),geoc))
  </code></pre>
  
  <p>Is there a way to slow this down to about 5 queries per second?  It works great if I'm only geocoding 5 or 10 at a time, but anything over there throws Google errors.</p>
  
  <p>Thanks!</p>