title: Why is my list extraction to a data frame resulting in fewer values than the list contains?
body: <p>I have a list of around 200,000 elements.</p>
  
  <p>Each element stores two values and represents map coordinates (latitude and longitude).</p>
  
  <p>I want to extract the values into <code>lat</code> and <code>lon</code> variables and so far have come up with this:</p>
  
  <pre><code>for(i in nrow(users)) {
    lat[i] &lt;- users$location[[i]][1]
    lon[i] &lt;- users$location[[i]][2]
  }
  
  coords &lt;- as.data.frame(cbind(lat, lon))
  </code></pre>
  
  <p>As far as I can see, it appears to have extracted the first element and then 19 elements at the end with nothing between (20 in total when checking with <code>complete.cases</code>).</p>
  
  <p>Ideally, I would like to exclude <code>NA</code> and <code>0, 0</code> values also.</p>
  
  <p>Looking at the list directly, I can see that this is wrong as there are several values contained within it.</p>
  
  <p>If I compare the final data frame to the list items, the figures don't match.  For example, the value <code>-73.9924</code> exists in the list but not in my data frame.</p>
  
  <p>Where am I going wrong?</p>
  
  <p><strong>My final data frame:</strong></p>
  
  <pre><code>&gt; coords[complete.cases(coords), ]
              lat       lon
  1       37.4590 -122.1781
  96960   40.8152  -73.3624
  96961   40.0409  -75.6374
  96962   42.5153  -70.9075
  96963   33.7773  -84.3366
  96964   39.9831  -86.2876
  96965   40.7588  -73.9680
  96966   36.7646  -76.1990
  96967   44.7415  -91.3012
  96968   42.6179  -70.7154
  96969   40.5953  -74.6173
  96970   50.8000   -0.3667
  96971   34.0523 -118.3852
  96972   41.4468  -74.0689
  96973   26.9467  -80.2170
  96974   40.7139  -74.0079
  96975   34.2313 -118.1486
  96976   43.6655  -79.4378
  96977   39.0972  -84.1225
  96978 -122.1781   37.4590
  </code></pre>
  
  <p><strong>Sample of list contents:</strong></p>
  
  <pre><code>[[734]]
  [1] 0 0
  
  [[735]]
  [1] 0 0
  
  [[736]]
  [1] 0 0
  
  [[737]]
  [1] 0 0
  
  [[738]]
  [1] -73.9924  40.7553
  
  [[739]]
  [1] 0 0
  
  [[740]]
  [1] -76.7818  39.4370
  
  [[741]]
  [1] -97.822  37.751
  
  [[742]]
  NULL
  
  [[743]]
  [1] 0 0
  
  [[744]]
  [1] 0 0
  </code></pre>