Plot survival results
plotSurvival.Rd
Plot survival results
Usage
plotSurvival(
result,
x = "time",
xscale = "days",
ylim = c(0, NA),
xlim = NULL,
cumulativeFailure = FALSE,
ribbon = TRUE,
facet = NULL,
colour = NULL,
riskTable = FALSE,
riskInterval = 30
)
Arguments
- result
Survival results
- x
Variable to plot on x axis
- xscale
X axis scale. Can be "days" or "years".
- ylim
Limits for the Y axis
- xlim
Limits for the X axis
- cumulativeFailure
whether to plot the cumulative failure probability instead of the survival probability
- ribbon
If TRUE, the plot will join points using a ribbon
- facet
Variables to use for facets
- colour
Variables to use for colours
- riskTable
Whether to print risk table below the plot
- riskInterval
Interval of time to print risk table below the plot
Examples
# \donttest{
cdm <- mockMGUS2cdm()
#> ■■■■■■■■■■■■■■■■■■■■■■■■■ 80% | ETA: 1s
surv <- estimateSingleEventSurvival(cdm,
targetCohortTable = "mgus_diagnosis",
outcomeCohortTable = "death_cohort")
#> - Getting survival for target cohort 'mgus_diagnosis' and outcome cohort
#> 'death_cohort'
#> Getting overall estimates
#> `eventgap`, `outcome_washout`, `censor_on_cohort_exit`, `follow_up_days`, and
#> `minimum_survival_days` casted to character.
plotSurvival(surv)
#> `result_id` is not present in result.
#> `result_id` is not present in result.
#> Warning: There was 1 warning in `dplyr::mutate()`.
#> ℹ In argument: `estimate_value = as.numeric(.data$estimate_value)`.
#> Caused by warning:
#> ! NAs introduced by coercion
# }