vec_fun() converts an input vector to a continuous, thrice-differentiable function. i is the function domain; if left empty, the vector indices will be used. Interpolation is performed using splinefun(method = "natural"); see that function for details.

vec_fun(y, x = NULL, ties = "ordered")

Arguments

x

A vector to convert to a continuous function

ties

"ordered", a function that takes a single numeric vector and returns a single number, or a list of length 2 with components meeting the previous specifications. See the documentation for ties and "Details" in approx() for further explanation.

i

An optional vector defining the input values for each output x

dev_interp

Development argument - do not use

Value

A function with arguments x and deriv that returns the interpolated values of the input vectors (or the 1st - 3rd derivatives)

Details

vec_fun() is stricter than splinefun() in the accepted inputs; in vec_fun(), x and i (if provided) must be cast-able to double() and of the same length.

The ties argument determines behavior when two values have the same (i, x) coordinates. The default for vec_fun() is to assume the inputs are ordered and proceed as usual; this is different than the default for splinefun().