RFC: spline / splinefun (etc) amalgamation

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Tue, 26 May 1998 08:58:52 +0200


>>>>> "KH" == Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> writes:

>>>>> Ross Ihaka writes:
    >> At present R has separate functions "spline" and "splinefun".  The
    >> first of these carries out spline interpolation of a data set and
    >> returns the interpolated values; the second returns the
    >> interpolating function itself (approx and approxfun are similar).

    >> I would like to combine these into a single function "spline" with
    >> an (optional) argument which determines which kind of value is
    >> returned.  E.g.

    >> spline(x,y) # return interpolated function spline(x,y,fun=T) #
    >> return the interpolating function

    >> I would also like to propose this as a standard for smoothing and
    >> interpolating functions.  This has a couple of advantages - fewer
    >> names to remember and, the ability to use the function form in model
    >> fitting code ("predict" for example).

    >> Any objections or comments?

Very good idea [including the "standard"!]

    KH> Perhaps smoothing.or.interpolating.fun(data) should in general
    KH> return the FUNCTION (more precisely, a function object of an
    KH> appropriate class), and the values would be obtained via predict()?

I do prefer Ross' version:

1. For a novice or average user, it is more intuitive to get a list /
   data.frame as a result by default.

2. compatibility
    KH> (May not be BBC, though ...)
   yes

3. The ($x, $y) list is simpler AND smaller (in memory).

Martin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._