title: Using revgeocode function in a FOR loop. Help required
body: <p>My problem is as detailed below: </p>
  
  <p>My input data is of the format as given in the small example below: </p>
  
  <pre><code>USERID  LONGITUDE   LATITUDE 
  1            -8.79659           55.879554 
  2           -6.874743           56.87896 
  3           -3.874743           58.87896 
  4          -10.874743           80.87896 
  </code></pre>
  
  <p>I have used the follwoing code to reverse geocode the latitiude and longitude </p>
  
  <pre><code>dset &lt;- as.data.frame(dataset[,2:3]) 
  dset &lt;- na.omit(dset) 
  
  library (ggmap) 
  location &lt;- dset 
  nrow(location) 
  
  locaddr &lt;- matrix(0,nrow(location),1) 
  location &lt;- as.matrix(location) 
  for (i in 1:nrow(location)) 
  { 
  
  
     locaddr[i,] &lt;- revgeocode(location[i,], output = c("address"), messaging = FALSE, sensor = FALSE, override_limit = FALSE)
  
  
  
  }
  </code></pre>
  
  <p>Now certain longitude-latitude return NA from Google Maps API. But when this happens the for loop is terminated for some reason. I would like to circumvent this and continue processing for the remaining data points. One idea I had was the following pseudocode: </p>
  
  <pre><code>if i = nrow(location) 
  continue 
  else 
  repeat revgeocode for loop here 
  end-for 
  end-if. 
  </code></pre>
  
  <p>Kindly advise how this can be done or if there is a better way to do this. </p>
  
  <p>Thank you in advance for your time and help. </p>