r - Convert spline interpolation to linear interpolation? -


this function below doing job spline interpolation wonder how can modify linear interpolation instead!

  ## function interpolate using spline     imagespline = function(x, y, xout, method = "natural", ...){     x.max = max(xout)     x.spline = spline(x = x, y = y, xout = xout, method = method, ...)     x.spline     } 

see ?approx approx() , approxfun(). these linear interpolation counterparts spline() , splinefun().

depending on detail of linear interpolation want perform (see ?approx details , things tweak), simple as:

imageapprox <- function(x, y, xout, ...) {     x.linear <- approx(x = x, y = y, xout = xout, ...)     x.linear } 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -