title: Performing constant interpolation in R
body: <p>I have a set of data, for example:</p>
  
  <pre><code>x&lt;-c(1, 2, 3, 4, 5, 6)
  y&lt;-c(100, 110, 121, 133.1, NA, 161.051)
  </code></pre>
  
  <p>Now, <code>y</code> is clearly increasing at a constant rate of 10%.</p>
  
  <p>I want to be able to interpolate the data at <code>x=5</code>, and I want to print <code>146.41</code> as the answer. However, this function doesn't seem to do it:</p>
  
  <pre><code>approx(x,y,5)
  </code></pre>
  
  <p>This prints <code>147.0755</code>, which is  not the answer i'm looking for.</p>
  
  <pre><code>approx(x,y,5,method="constant")
  </code></pre>
  
  <p>doesn't do the trick either.</p>
  
  <p>Where am I going wrong?</p>