

   SStteepp FFuunnccttiioonnss

        fn <- stepfun(x, y, f=0)
        is.stepfun(fn)
        knots(fn)
        plot(fn, ...)
        print(fn, ...)
        summary(fn)

   AArrgguummeennttss::

          x: numeric vector giving the ``knots'' or jump loca-
             tions of the step function.

          y: numeric vector one longer than `x', giving the
             heights of the function values between the x val-
             ues.

          f: a number between 0 and 1, indicating how interpo-
             lation outside the given x values should happen.
             See  `approxfun'.

         fn: an object inheriting from `"stepfun"'.

   DDeessccrriippttiioonn::

        Given the vectors (x[1],..., x[n]) and (y[0],y[1],...,
        y[n])  (one value more!), `stepfun(x,y,...)' returns an
        interpolating ``step'' function, say `fn'. I.e., fn(t)
        = c[i] (constant) for t in ( x[i], x[i+1]) and fn(x[i])
        = y[i] for i=1,...,n.

        The value of the constant c[i] above depends on the
        ``continuity'' parameter `f'.  For the default, `f =
        0', `fn' is a ``cadlag'' function, i.e.  continuous at
        right, limit (``the point'') at left.  In general, c[i]
        is interpolated in between the neighbouring y values,
        c[i] = (1-f)*y[i] + f*y[i+1].  Therefore, for non-0
        values of `f', `fn' may no longer be a proper step
        function, since it can be discontinuous from both
        sides.

   VVaalluuee::

        A function of class `"stepfun"', say `fn'.  There are
        methods available for summarizing (`"summary(.)"'),
        representing (`"print(.)"') and plotting  (`"plot(.)"',
        see `plot.stepfun') `"stepfun"' objects.

        The `environment' of `fn' contains all the information
        needed;   `"x","y"': the original arguments;   `"n"':
        number of knots (x values);   `"f"': continuity parame-
        ter;   `"yleft", "yright"' the function values outside
        the knots;   `"method"' (always `== "constant"'; not
        used, from `approxfun(.)').  The knots are also avail-
        able by `knots(fn)'.

   AAuutthhoorr((ss))::

        Martin Maechler, maechler@stat.math.ethz.ch with some
        basic code from Thomas Lumley.

   SSeeee AAllssoo::

        `ecdf' for empiricial distribution functions as special
        step functions and `plot.stepfun' for plotting step
        functions.

        `approxfun' and `splinefun'.

   EExxaammpplleess::

        y0 <- c(1,2,4,3)
        sfun0  <- stepfun(1:3, y0, f = 0)
        sfun.2 <- stepfun(1:3, y0, f = .2)
        sfun1  <- stepfun(1:3, y0, f = 1)
        sfun0
        summary(sfun0)
        summary(sfun.2)

        x0 <- seq(0.5,3.5, by = 0.25)
        rbind(x=x0, f.f0 = sfun0(x0), f.f02= sfun.2(x0), f.f1 = sfun1(x0))

