stepfun
Compute a Step Function
Description
Computes a left- or right-continuous step function.
Usage
stepfun(x, y, f = as.numeric(right), ties = "ordered", right = FALSE) 
is.stepfun(x)
knots(Fn, ...)
## S3 method for class 'stepfun':
knots(Fn, ...) 
## S3 method for class 'stepfun':
summary(object, ...)
as.stepfun(x, ...)
## Default S3 method:
as.stepfun(x, ...)
Arguments
| x | For stepfun, a numeric vector giving the breakpoints (knots) of the step function.
x must be sorted by increasing order and have at least one element.
indicates points of plateau levels.
For as.stepfun and is.stepfun, x is any object.
For print.stepfun, x is an object that inherits from "stepfun". | 
| y | a numeric vector, with length 1 + length(x),
indicating the possible values of the step function.
If right is FALSE the value at x[i]
will be y[i+1], if TRUE it will be y[i]. | 
| f | A number between 0 and 1 indicating how the levels of the plateaus
between jump points should be calculated.  For a plateau between
jump points level will be 1-f times the value at the left jump
point plus f times the value at the right jump point.
The plateau to the left of x[1] will have value y[1],
that to the left of x[length(x)] will have value y[length(x)+1],
regardless of the value of f or right. | 
| ties | arguments to be passed to function "approxfun". | 
| right | a logical value, if TRUE, the value at x[i] will be y[i],
otherwise y[i+1]. | 
| Fn | an object inheriting from "stepfun". | 
| digit | the maximum number of digits after the decimal point to print. | 
| ... | additional arguments to be passed to or from future functions. | 
 
Value
| stepfun | returns a function of one argument v, which
performs the interpolation specified. | 
| is.stepfun | returns TRUE if x is a function and inherits from "stepfun". | 
| knots | returns a vector containing knots (breakpoints) of a stepfun object. | 
| print.stepfun | returns x, with the invisible set to prevent reprinting. | 
| summary.stepfun | invisibly returns NULL. | 
| as.stepfun | returns a stepfun object implied by its input.
This is a generic function and the basic methods do nothing useful:
the default method gives an error and the stepfun method returns
its input. | 
 
See Also
Examples
y0 <- c(1, 2, 3)
sfun0  <- stepfun(c(4, 5), c(11, 12, 17), f = 0)
sfun0(c(3.7, 4, 4.2, 5, 5.1))
is.stepfun(sfun0)
knots(sfun0)
print(sfun0)