analyse_survival {survivalAnalysis} | R Documentation |
Univariate survival analysis
Description
Performs survival analysis on right-censored data using a single covariate, or no covariate.
Usage
analyse_survival(
data,
time_status,
by,
by_label_map = NULL,
by_order_vector = NULL,
cox_reference_level = NULL,
p_adjust_method = "none",
plot_args = list()
)
analyze_survival(
data,
time_status,
by,
by_label_map = NULL,
by_order_vector = NULL,
cox_reference_level = NULL,
p_adjust_method = "none",
plot_args = list()
)
Arguments
data |
A data frame containing the time/status information and, if used, the covariate. |
time_status |
A vector of length 2 giving the time and status fields.
It is recommended to use vars() and symbolic column names or code that is tidily-evaluated on |
by |
The term by which survival curves will be separated.
Pass |
by_label_map |
A dictionary (named list or vector) of old->new labels of the factor created using |
by_order_vector |
A vector of the labels of the factor created using |
cox_reference_level |
The result will include a univariate Cox regression. Use this parameter to specify
the level of the factor generated using |
p_adjust_method |
If there are more than two levels in the |
plot_args |
Named list of arguments that will be stored for later use in plotting methods, such as kaplan_meier_plot. There they will take precedence over arguments given to that method. This is useful when plotting multiple results with a set of default arguments, of which some such as title or axis scale differ per-plot. |
Details
This method builds upon the survival
package and returns a comprehensive result object
for survival analysis containing the survfit, survdiff and coxph results.
A format
/print
method is provided that prints the essential statistics.
Kaplan-Meier plots are readily generated using the kaplan_meier_plot
or
kaplan_meier_grid
functions.
Value
An object of class "SurvivalAnalysisResult" and "SurvivalAnalysisUnivariateResult".
You can use this result as a black box for further functions in this package,
format
or
print
it,
retrieve information as a data frame via survival_data_frames
or
access individual pieces via pluck_survival_analysis
Examples
library(magrittr)
library(dplyr)
survival::aml %>%
analyse_survival(vars(time, status), x) %>%
print