tabulate_mmrm_subgroups {tern.mmrm} | R Documentation |
Tabulation of MMRM Subgroups Results
Description
This function tabulates the results from extract_mmrm_subgroups()
.
Usage
tabulate_mmrm_subgroups(
lyt,
df,
vars = c("n_tot", "n", "lsmean", "diff", "ci"),
.formats = list(n = "xx", n_tot = "xx", lsmean = "xx.x", diff = "xx.x", ci =
"(xx.x, xx.x)", pval = "x.xxxx | (<0.0001)"),
.labels = list(n = "n", n_tot = "Total n", lsmean = "Mean", diff = "Mean Difference",
ci = paste0(round(100 * df$contrasts$conf_level[1]), "% CI"), pval = "p-value")
)
Arguments
lyt |
( |
df |
( |
vars |
( |
.formats |
(named |
.labels |
(named |
Value
The rtables
object.
Examples
mmrm_results <- fit_mmrm(
vars = list(
response = "FEV1",
covariates = "RACE",
id = "USUBJID",
arm = "ARMCD",
visit = "AVISIT"
),
data = mmrm_test_data,
cor_struct = "compound symmetry",
weights_emmeans = "equal",
averages_emmeans = list(
"VIS1+2" = c("VIS1", "VIS2")
)
)
df <- extract_mmrm_subgroups(
fit = mmrm_results,
visit = "VIS3",
subgroups = c("RACE", "SEX")
)
## Table with default columns.
basic_table() %>%
tabulate_mmrm_subgroups(df)
## Table with selected columns.
tab <- basic_table() %>%
tabulate_mmrm_subgroups(
df = df,
vars = c("n_tot", "diff", "ci", "pval")
)
tab
## Forest plot can be produced based on this very easily.
g_forest(tab, logx = FALSE, xlim = c(-10, 10), x_at = c(-10, -5, 0, 5, 10), vline = 0)