Learn R Programming

visR (version 0.4.1)

add_quantiles: Add quantile indicators to visR plot

Description

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, ... )

Value

Lines indicating the quantiles overlayed on a visR ggplot

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

Examples

Run this code

library(visR)

adtte %>%
  estimate_KM("SEX") %>%
  visr() %>%
  add_quantiles()

adtte %>%
  estimate_KM("SEX") %>%
  visr() %>%
  add_quantiles(quantiles = c(0.25, 0.50))

adtte %>%
  estimate_KM("SEX") %>%
  visr() %>%
  add_quantiles(
    quantiles = c(0.25, 0.50),
    linetype = "solid",
    linecolour = "grey"
  )

adtte %>%
  estimate_KM("SEX") %>%
  visr() %>%
  add_quantiles(
    quantiles = c(0.25, 0.50),
    linetype = "mixed",
    linecolour = "strata"
  )

Run the code above in your browser using DataLab