title: R remove first row of data frame until first row has no NA
body: <p>I am applying na.approx on a data frame, which will not work if an NA happens to be in the very first or very last row of my data base. </p>
  
  <p>How do I write a function doing the following:
  "While any value of the first row of the data frame is NA, remove the first row"</p>
  
  <p>Example data frame:</p>
  
  <pre><code>x1=x2=c(1,2,3,4,5,6,7,8,9,10,11,12)
  x3=x4=c(NA,NA,3,4,5,6,NA,NA,NA,NA,11,12)
  df=data.frame(x1,x2,x3,x4)
  </code></pre>
  
  <p>result for this example data frame should look like this:</p>
  
  <pre><code>result=df[-1:-2,]
  </code></pre>
  
  <p>My current attempts all look similar to this:</p>
  
  <pre><code>replace_na=function(df){
  while(anyNA(df[1,])=TRUE){
    df=df[-1,],
    return(df)
  }  
  #this is where I would apply the na.approx function to the data frame
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated, thanks!</p>