add_risktable: Add risk tables to visR plots through an S3 method

Description Usage Arguments Value Author(s) See Also Examples

View source: R/add_risktable.R

Description

S3 method for adding risk tables to visR plots. No default method is available at the moment.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
add_risktable(gg, ...)

## S3 method for class 'ggsurvfit'
add_risktable(
  gg,
  min_at_risk = 0,
  time_ticks = NULL,
  display = c("n.risk"),
  title = c("Subjects at risk")
)

Arguments

gg

visR plot of class 'ggsurvfit'

...

other arguments passed on to the method

min_at_risk

numeric The cutoff for number of subjects to display. Default is 0.

time_ticks

Numeric vector with the points along the x-axis at which the summary data needs to be provided.

display

Character vector indicating which summary data to present. Current choices are "n.risk" "n.event" "n.censor".

title

Character vector with titles for the summary tables.

Value

Object of class ggplot with added risk table.

Author(s)

Steven Haesendonckx

See Also

plot_grid

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(survival)
library(dplyr)
library(tidyr)
library(ggplot2)
library(cowplot)
library(gtable)

survfit_object <- survival::survfit(data = adtte, Surv(AVAL, 1-CNSR) ~ TRTP)
vr_plot(survfit_object) %>%
  add_risktable(min_at_risk = 3, title = c("blah"), display = c("n.risk", "n.censor"))
 

visR-sandbox/visR-survival documentation built on Sept. 18, 2020, 6:21 p.m.