title: Interpolate multiple NA values with R
body: <p>I want to  interpolate multiple <code>NA</code> values in a matrix called, tester. </p>
  
  <p>This is a part of tester with only 1 column of NA values, in the whole 744x6 matrix other columns have multiple as well:</p>
  
  <pre><code>ZONEID   TIMESTAMP         U10            V10            U100          V100
  1        20121022 12:00    -1.324032e+00  -2.017107e+00 -3.278166e+00  -5.880225574
  1        20121022 13:00    -1.295168e+00            NA  -3.130429e+00  -6.414975148
  1        20121022 14:00    -1.285004e+00            NA  -3.068829e+00  -7.101699541
  1        20121022 15:00    -9.605904e-01            NA  -2.332645e+00  -7.478168285
  1        20121022 16:00    -6.268261e-01 -3.057278e+00  -1.440209e+00  -8.026791079
  </code></pre>
  
  <p>I have installed the <code>zoo</code> package and used the code <code>library(zoo)</code>. I have tried to use the <code>na.approx</code> function, but it returns on a linear basis:</p>
  
  <pre><code>na.approx(tester)
  # Error ----&gt; need at least two non-NA values to interpolate
  
  na.approx(tester, rule = 2)
  # Error ----&gt; need at least two non-NA values to interpolate
  
  na.approx(tester, x = index(tester), na.rm = TRUE, maxgap = Inf)
  </code></pre>
  
  <p>Afterward I tried:</p>
  
  <pre><code>Lines &lt;- "tester"
  library(zoo) 
  z &lt;- read.zoo(textConnection(Lines), index = 2)[,2] 
  na.approx(z)
  </code></pre>
  
  <p>Again I got the same multiple <code>NA</code> values error. I also tried:</p>
  
  <pre><code>z &lt;- zoo(tester)
  index(Cz) &lt;- Cz[,1]
  Cz_approx &lt;- na.approx(Cz)
  </code></pre>
  
  <p>Same error. </p>
  
  <p>I must be doing something really stupid, but I would really appreciate your help.</p>