get_risktable: Obtain risk tables for tables and plots

View source: R/get_risktable.R

get_risktableR Documentation

Obtain risk tables for tables and plots

Description

Create a risk table from an object using an S3 method. Currently, no default method is defined.

Usage

get_risktable(x, ...)

## S3 method for class 'survfit'
get_risktable(
  x,
  times = NULL,
  statlist = "n.risk",
  label = NULL,
  group = c("strata", "statlist"),
  collapse = FALSE,
  ...
)

## S3 method for class 'tidycuminc'
get_risktable(
  x,
  times = pretty(x$tidy$time, 10),
  statlist = "n.risk",
  label = NULL,
  group = c("strata", "statlist"),
  collapse = FALSE,
  ...
)

Arguments

x

an object of class survfit or tidycuminc

...

other arguments passed on to the method

times

Numeric vector indicating the times at which the risk set, censored subjects, events are calculated.

statlist

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

label

Character vector with labels for the statlist. Default matches "n.risk" with "At risk", "n.event" with "Events", "n.censor" with "Censored", "cum.event" with "Cum. Event", and "cum.censor" with "Cum. Censor".

group

String indicating the grouping variable for the risk tables. Current options are:

  • "strata": groups the risk tables per stratum. The label specifies the label within each risk table. The strata levels are used for the titles of the risk tables. This is the default

  • "statlist": groups the risk tables per statlist. The label specifies the title for each risk table. The strata levels are used for labeling within each risk table.

Default is "strata".

collapse

Boolean, indicates whether to present the data overall. Default is FALSE.

Value

return list of attributes the form the risk table i.e. number of patients at risk per strata

See Also

summary.survfit


visR documentation built on Nov. 21, 2023, 1:07 a.m.