stepfun(datax, datay=<<see below>>, type="left")
datax
and
datay
giving the locations of the jumps in the function. The values in
datax
must be in increasing order.
type="left"
, the given points in
datax
and
datay
are at the left end of the level steps of the function; this gives a right-continuous function. If
type="right"
, the given points are at the right end of the level steps of the function; this gives a left-continuous function. Only the first character of the string is needed.
x
and
y
, described below. The return value from
stepfun
is suitable for passing in to the functions
plot
,
points
, and
lines
.
datax
with all but one of the end values repeated.
datay
.
When
type="left"
, each element of the input
datay
is for the corresponding
datax
element and the next
datax
element. For
type="right"
, each element of
datay
is for the corresponding
datax
element and the previous
datax
element.
The
type
graphics parameter can be set to
"s"
or
"S"
to plot step functions. See the help file for
par
for more details.
fit <- survfit(Surv(futime, fustat), data=ovarian) plot(stepfun(fit$time, fit$surv), type='l') # Add 95% confidence intervals. oldpar <- par(err=-1) # Avoid the "Lines out of bounds" messagges lines(stepfun(fit$time, exp(log(fit$surv) + 1.96*fit$std.err))) lines(stepfun(fit$time, exp(log(fit$surv) - 1.96*fit$std.err))) par(oldpar) # Turn graphics warnings back on