Description Usage Arguments Details Value Examples
Performs survival analysis on right-censored data using a single covariate, or no covariate.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 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()
)
|
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. |
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.
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
1 2 3 4 5 | library(magrittr)
library(dplyr)
survival::aml %>%
analyse_survival(vars(time, status), x) %>%
print
|
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
Analysis by x:
Overall Analysis:
log.rank.p n median Lower.CI Upper.CI min max
overall: p=0.065 23 27.0 18.0 45.0 5.0 161.0
Descriptive Statistics per Subgroup:
records events median Lower.CI Upper.CI
Maintained 11 7 31.0 18.0 NA
Nonmaintained 12 11 23.0 8.0 NA
Hazard Ratio:
Lower.CI HR Upper.CI p
Nonmaintained vs. Maintained 0.92 2.5 6.81 0.074
Maintained vs. Nonmaintained 0.15 0.4 1.09 0.074
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.