This function creates survival curves from either a formula (e.g. the Kaplan-Meier), a previously fitted Cox model, or a previously fitted accelerated failure time model.

`survfit(formula, ...)`

An object of class `survfit`

containing one or more survival curves.

- formula
either a formula or a previously fitted model

- ...
other arguments to the specific method

Terry Therneau

A survival curve is based on a tabulation of the number at risk and
number of events at each unique death time. When time is a floating
point number the definition of "unique" is subject to interpretation.
The code uses factor() to define the set.
For further details see the documentation for the appropriate method, i.e.,
`?survfit.formula`

or `?survfit.coxph`

.

A survfit object may contain a single curve, a set of curves (vector), a
matrix of curves, or even a 3 way array: `dim(fit)`

will reveal
the dimensions.
Predicted curves from a `coxph`

model have one row for each
stratum in the Cox model fit and one column for each specified
covariate set.
Curves from a multi-state model have one row for each stratum and
a column for each state, the strata correspond to predictors on the
right hand side of the equation. The default printing and plotting
order for curves is by column, as with other matrices.

`survfit.formula`

,
`survfit.coxph`

,
`survfit.object`

, `print.survfit`

,
`plot.survfit`

, `quantile.survfit`

,
`residuals.survfit`

, `summary.survfit`