Skip to contents

Method to add quantile lines to a plot.

Usage

add_quantiles(gg, ...)

# S3 method for ggsurvfit
add_quantiles(
  gg,
  quantiles = 0.5,
  linetype = "dashed",
  linecolour = "grey50",
  alpha = 1,
  ...
)

Arguments

gg

A ggplot created with visR

...

other arguments passed on to the method to modify geom_line

quantiles

vector of quantiles to be displayed on the probability scale, default: 0.5

linetype

string indicating the linetype as described in the aesthetics of ggplot2 geom_line, default: dashed (also supports "mixed" -> horizontal lines are solid, vertical ones are dashed)

linecolour

string indicating the linetype as described in the aesthetics of ggplot2 geom_line, default: grey, (also supports "strata" -> horizontal lines are grey50, vertical ones are the same colour as the respective strata)

alpha

numeric value between 0 and 1 as described in the aesthetics of ggplot2 geom_line, default: 1

Value

Lines indicating the quantiles overlayed on a visR ggplot

Examples


library(visR)

adtte %>%
  estimate_KM("SEX") %>%
  visr() %>%
  add_quantiles()
#> Warning: no non-missing arguments to min; returning Inf


adtte %>%
  estimate_KM("SEX") %>%
  visr() %>%
  add_quantiles(quantiles = c(0.25, 0.50))
#> Warning: no non-missing arguments to min; returning Inf


adtte %>%
  estimate_KM("SEX") %>%
  visr() %>%
  add_quantiles(
    quantiles = c(0.25, 0.50),
    linetype = "solid",
    linecolour = "grey"
  )
#> Warning: no non-missing arguments to min; returning Inf


adtte %>%
  estimate_KM("SEX") %>%
  visr() %>%
  add_quantiles(
    quantiles = c(0.25, 0.50),
    linetype = "mixed",
    linecolour = "strata"
  )
#> Warning: no non-missing arguments to min; returning Inf