| add_riskdiff | R Documentation | 
Wrapper function for rtables::add_combo_levels() which configures settings for the risk difference
column to be added to an rtables object. To add a risk difference column to a table, this function
should be used as split_fun in calls to rtables::split_cols_by(), followed by setting argument
riskdiff to TRUE in all following analyze function calls.
add_riskdiff(
  arm_x,
  arm_y,
  col_label = paste0("Risk Difference (%) (95% CI)", if (length(arm_y) > 1)
    paste0("\n", arm_x, " vs. ", arm_y)),
  pct = TRUE
)
| arm_x | ( | 
| arm_y | ( | 
| col_label | ( | 
| pct | ( | 
A closure suitable for use as a split function (split_fun) within rtables::split_cols_by()
when creating a table layout.
stat_propdiff_ci() for details on risk difference calculation.
adae <- tern_ex_adae
adae$AESEV <- factor(adae$AESEV)
lyt <- basic_table() %>%
  split_cols_by("ARMCD", split_fun = add_riskdiff(arm_x = "ARM A", arm_y = c("ARM B", "ARM C"))) %>%
  count_occurrences_by_grade(
    var = "AESEV",
    riskdiff = TRUE
  )
tbl <- build_table(lyt, df = adae)
tbl
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.