title: How to escape error of length when suppressing NA values in data frame?
body: <p>I have a data.frame with a lot of NAs but each column has not the different length without the NAs and I would like to have an identical data frame but without the NAs.
  So when I am doing : </p>
  
  <pre><code>  for (i in 1:length(df[,1]))
        (df[,i]&lt;-df[,i][!is.na(df[,i])])
  </code></pre>
  
  <p>It answers :</p>
  
  <pre><code>  Error in `[&lt;-.data.frame`(`*tmp*`, , i, value = c(2696L, 2696L, 2640L,  : 
  </code></pre>
  
  <p>Do anyone has an idea how to do it ?</p>