.BG
.EQ
delim $$
.EN
.FN approx
.TL
Approximate Function from Discrete Values
.CS
approx(x, y, xout, method="lines", n=50, rule=1)
.XY
The `y' values represent the surface to be approximated as a function of
`x'.
.AG xout
optional set of x values for which function values are
desired.  If `xout' is not specified, the function will be
approximated at `n' equally spaced data points, spanning the range of `x'.
.AG method
character describing the method to be used in approximating
the function.  Currently the only possible value is
.Co  """linear""" 
for linear
interpolation (later may have
.Co   """spline""" ,
etc).
.AG n
optional integer giving the number of points evenly spaced
between the minimum and maximum values in `x' to be used in
forming `xout'.
.AG rule
integer describing the rule to be used for values of `xout'
that are outside the range of `x'.  If `rule' is 1
`NA's will be supplied for any such points.  If
`rule' is 2, the `y' values corresponding to the extreme `x'
values will be used.
.RT
list with components named `x' and `y'.
.SA
`spline', `lowess'.
.EQ
delim off
.EN
.EX
z <- approx(x,y,newx)   # linear interpolation at newx
quants <- approx(ppoints(x),sort(x),c(.1,.25,.5,.75,.9))$y
   # get the 10, 25, 50, 75 and 90 percentiles of x
.KW dplot
.KW math
.WR
