title: R error - subscript out of bounds
body: <p>I am trying to run this code which takes a list of addresses and runs each one through Google's Geocode API (using function Addr2latlng below) to get the latitude/longitude and puts each one into a data frame using ProcessAddrList below.</p>
  
  <p>The problem is Addr2latlng works fine for one address and ProcessAddrList works fine for up to 10 addresses, but from 11 addresses or more I get the error below. For 10 addresses this works fine. </p>
  
  <p>To run the code below requires the packages RCurl and RJSONIO to be loaded. </p>
  
  <pre><code>Error in geoStruct$results[[1]] : subscript out of bounds
  Error in geoStruct$results[[1]] : subscript out of bounds
  </code></pre>
  
  <p><br /></p>
  
  <pre><code>ProcessAddrList &lt;- function(addrList)
  
  {
    resultDF &lt;- data.frame(atext=character(),X=numeric(),Y=numeric(),EID=numeric())
  
    i &lt;- 1
  
    for (addr in addrList)
  
    {
      latlng = Addr2latlng(addr)
      resultDF &lt;-rbind(resultDF,data.frame(atext=addr,X=latlng[[2]],Y=latlng[[1]],EID=i))
      i &lt;- i+1
    }
  
    return (resultDF)
  }
  
  Addr2latlng &lt;- function(address)
  
  {
    url &lt;- MakeGeoURL(address)
    apiResult &lt;- getURL(url)
    geoStruct &lt;- fromJSON(apiResult, simplify = FALSE)
    lat &lt;- NA
    lng &lt;- NA
    try(lat &lt;- geoStruct$results[[1]]$geometry$location$lat)
    try(lng &lt;- geoStruct$results[[1]]$geometry$location$lng)
    return(c(lat, lng))
  
  }
  </code></pre>