Generate a waterfall plot

waterfall_plot(
  data_recist,
  rc_sum = "RCTLSUM",
  rc_resp = "RCRESP",
  rc_date = "RCDT",
  type = c("best_resp", "worst_resp"),
  rc_star = NULL,
  arm = NULL,
  subjid = "SUBJID",
  warnings = getOption("grstat_wp_warnings", TRUE)
)

Arguments

data_recist

recist dataset

rc_sum

name of the target lesions length sum column in data_recist, usually "RCTLSUM".

rc_resp

name of the response column in data_recist, usually "RCRESP".

rc_date

name of the date column in data_recist, usually "RCDT".

type

one of c("best_resp", "worst_resp")

rc_star

name of the column in data_recist that triggers the star symbol. The column should be character or factor, with NA for patients without symbol.

arm

name of the treatment column in data_recist. Can be left to NULL to not group.

subjid

name of the subject identifier column in data_recist.

warnings

whether to warn about any problems

Value

a ggplot

Methods

Data are ordered on rc_date.

Examples


if (FALSE) { # \dontrun{
waterfall_plot(rc, rc_date="RCDT", rc_sum="RCTLSUM", rc_resp="RCRESP")
waterfall_plot(rc, rc_date="RCDT", rc_sum="RCTLSUM", rc_resp="RCRESP", type="worst_resp")
rc %>%
  left_join(enrolres, by="SUBJID") %>% #adds the ARM column
  mutate(new_lesion = ifelse(RCNEW=="1-Yes", "New lesion", NA)) %>%
  waterfall_plot(rc_date="RCDT", rc_sum="RCTLSUM", rc_resp="RCRESP",
                 arm="ARM", rc_star="new_lesion")
} # }