plot_rmst_individual_by_group: Plot individual dynamic RMST curves by group

View source: R/plots.R

plot_rmst_individual_by_groupR Documentation

Plot individual dynamic RMST curves by group

Description

Plot individual dynamic RMST curves by group

Usage

plot_rmst_individual_by_group(
  res,
  group,
  n_show_per_group = 30,
  title = "Individual dynamic RMST by group",
  x_scale = 1,
  y_scale = 1,
  x_unit = NULL,
  y_unit = NULL
)

Arguments

res

Result from rmst_dynamic() containing individual and time.

group

Group vector aligned with rows of res$individual.

n_show_per_group

Maximum number of individual curves shown per group.

title

Plot title.

x_scale

Positive divisor applied to the x-axis values before plotting.

y_scale

Positive divisor applied to the y-axis values before plotting.

x_unit

Optional unit label appended to the x-axis title.

y_unit

Optional unit label appended to the y-axis title.

Value

A ggplot object.

Examples


time <- c(0, 1, 2)
S <- rbind(
  c(1.0, 0.9, 0.7),
  c(1.0, 0.8, 0.6),
  c(1.0, 0.95, 0.8),
  c(1.0, 0.85, 0.7)
)
grp <- c("A", "A", "B", "B")
x <- as_survmat(S, time, group = grp)
res <- rmst_dynamic(x)
plot_rmst_individual_by_group(res, grp, n_show_per_group = 2)


tvrmst documentation built on March 17, 2026, 1:07 a.m.