title: put lists at the same length
body: <p>I'm trying to make a loop whose doing an lm equations on a nested lists of list. but my lists are not the same length, and so my equation isn't working
  I want to drop the lines where there's is NA or Zero, and the corresponding line in the lists.</p>
  <p>what I have :</p>
  <pre><code>nested_list
  [[1]]
  [1] x    double(1234)
      y    double(4321)
  </code></pre>
  <p>what I want :</p>
  <pre><code>nested_list
  [[1]]
  [1] x    double(1234)
      y    double(1234)
  </code></pre>
  <p>and that my beginning of code:</p>
  <pre><code>pairs &lt;- list()
  n &lt;- 1;
  for(i in 1:length(xdata)) {
    for(j in 1:length(ydata)) {
      pairs[[n]] &lt;- c(xdata[i], ydata[j])
  
     pairs[[n]]&lt;-lapply( pairs[[n]], function(x) x[!is.na(x)])  
      
      n &lt;- n + 1;
    }
  }
  </code></pre>
  <p>the only way i made this work is with a dataframe but it's not working with my loop after.
  And for the lists i've tried a lot of combinations(intersect, merge,rbind) but none worked...
  if you have any ideas how to make this work, thank you.</p>