title: Replace NAs using na.approx or na.spline for matrix data
body: <p>I am quite new to R and currently have a problem, where data looks like this:</p>
  
  <pre><code>    ID      h1      h2     h3      h4      h5      h6     h7     h8  
      IP6_1  0.1800   NA    -0.8600  NA      0.0400 -0.1400 1.4400 1.4900  
      IP6_2 -0.0250 -0.3050 -1.1050 -1.2150  0.0250  1.2750 1.7950 1.3850  
      IP6_3  0.2125 -0.1875   NA    -1.2225 -0.1425  0.7325 1.6275 1.3975  
      IP6_4  0.0150   NA    -1.0450 -0.3550  0.2950 -0.0150 0.3850 0.3050  
      IP6_5  0.1200 -0.0900 -0.9100 -0.6500  0.0900 -0.2700 0.9100 1.1200  
      IP6_6  0.0200 -0.0200 -0.8400 -0.6600   NA    -0.0900 0.6200 0.0800 
  </code></pre>
  
  <p>the data has random NAs which I want to replace using <a href="http://svitsrv25.epfl.ch/R-doc/library/zoo/html/na.approx.html" rel="nofollow noreferrer">na.approx</a> per <strong>row</strong>.
  I tried using it:</p>
  
  <pre><code>z_data &lt;- zoo(cluster_data_wf[,-1])        
  na.approx(z_data)
  </code></pre>
  
  <p>which doesn't replace any NA at all.</p>
  
  <p>Some help to replace NAs by linear interpolation via approx or cubic spline interpolation via spline would be appreciated.</p>
  
  <p>Edit: Final output should still have first column ID</p>