lintegrate
gives the values resulting from integrating a linear
spline, while ilspline
returns linear splines that
integrate to given values.
1 2  lintegrate(x, y, xint, stepfun = F, rule = 0)
ilspline(xint, w)

x 
x coordinates of the linear spline F defined by 
y 
y coordinates of the linear spline F defined by 
xint 
x intervals, i.e. 
stepfun 
if 
rule 
one of {0, 1, NA} to specify the behavior of F outside the
range of 
w 
values the linear spline must integrate to 
lintegrate
integrates the linear spline F defined by
(x,y)
over the xint
intervals. The value of F outside
the range of x
is specified by the rule
argument:
1 2 3 
If stepfun
is TRUE
, F(z) is assumed to be a
leftcontinuous step function and the last value of y
is never
accessed.
(x[i], y[i])
pairs with NA values in either x[i] or y[i] NA are
ignored in constructing F.
ilspline
finds linear splines that integrate over the N
intervals specified by the monotonically increasing N+1 vector
xint
to the N values given in w
. The function finds
Nvectors x and y such that:
1 2 3 4 5 6 7  (i) x[j] = (xint[j1] + xint[j])/2, i.e., the values of x are the
midpoints of the intervals specified by xint, and
(ii) the linear spline that passes through the (x[i], y[i]) pairs (and
is extended to xint[1] and xint[N+1] by linear
extrapolation) integrates over each interval [xint[j],xint[j+1]]
to w[j].

In fact, w
can actually be an M by N matrix, in which case the
y found by the function is also an M by N matrix, with each column of
y giving the y coordinates of a linear spline that integrates to the
corresponding column of w
.
lintegrate
returns a vector of length length(xint)  1
.
ilspline
returns a list with components named 'x' and 'y'.
spline
, approx
1 2 3 4  w < 10 + cumsum(rnorm(10))
blah < ilspline(1:11, w)
ww < lintegrate(blah$x, blah$y, 1:11, rule = 1)
w  ww ## should be all zeroes (or very close to zero)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.