[R] Linear extrapolation; revision to earlier posting

Frank E Harrell Jr fharrell at virginia.edu
Wed Apr 3 22:37:44 CEST 2002


The S-Plus approx function implements rule=3 (linear extrapolation), which is not implemented in R.  Has anyone extended approx to handle linear extrapolation?  

Regarding the use of approx for "closest matching" in my post from last week, you need to add ties=function(x)x[1], e.g.

round(approx(c(1,3,5,2,4,2,4),1:7,xout=c(1,3,5,2,4,2,4),rule=2,
       ties=function(x)x[1])$y)

-- 
Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list