a_summarize_ex_j {junco} | R Documentation |
Tabulation for Exposure Tables
Description
A function to create the appropriate statistics needed for exposure table
Usage
s_summarize_ex_j(
df,
.var,
.df_row,
.spl_context,
comp_btw_group = TRUE,
ref_path = NULL,
ancova = FALSE,
interaction_y,
interaction_item,
conf_level,
daysconv,
variables
)
a_summarize_ex_j(
df,
.var,
.df_row,
.spl_context,
comp_btw_group = TRUE,
ref_path = NULL,
ancova = FALSE,
interaction_y = FALSE,
interaction_item = NULL,
conf_level = 0.95,
variables,
.stats = c("mean_sd", "median", "range", "quantiles", "total_subject_years"),
.formats = c(diff_mean_est_ci = jjcsformat_xx("xx.xx (xx.xx, xx.xx)")),
.labels = c(quantiles = "Interquartile range"),
.indent_mods = NULL,
na_str = rep("NA", 3),
daysconv = 1
)
Arguments
df |
( |
.var |
( |
.df_row |
( |
.spl_context |
( |
comp_btw_group |
( |
ref_path |
( |
ancova |
( |
interaction_y |
( |
interaction_item |
( |
conf_level |
( |
daysconv |
conversion required to get the values into days (i.e 1 if original PARAMCD unit is days, 30.4375 if original PARAMCD unit is in months) |
variables |
(named list of strings)
|
.stats |
( |
.formats |
(named |
.labels |
(named |
.indent_mods |
(named |
na_str |
( |
Details
Creates statistics needed for standard exposure table
This includes differences and 95% CI and total treatment years.
This is designed to be used as an analysis (afun in analyze
) function.
Creates statistics needed for table. This includes differences and 95% CI and total treatment years.
This is designed to be used as an analysis (afun in analyze
) function.
Value
-
a_summarize_ex_j()
returns the corresponding list with formattedrtables::CellValue()
.
Functions
-
s_summarize_ex_j()
: Statistics function needed for the exposure tables -
a_summarize_ex_j()
: Formatted analysis function which is used asafun
.
Examples
library(dplyr)
ADEX <- data.frame(
USUBJID = c(
"XXXXX01", "XXXXX02", "XXXXX03", "XXXXX04", "XXXXX05",
"XXXXX06", "XXXXX07", "XXXXX08", "XXXXX09", "XXXXX10"
),
TRT01A = c(
"ARMA", "ARMA", "ARMA", "ARMA", "ARMA",
"Placebo", "Placebo", "Placebo", "ARMA", "ARMA"
),
AVAL = c(56, 78, 67, 87, 88, 93, 39, 87, 65, 55)
)
ADEX <- ADEX |>
mutate(TRT01A = as.factor(TRT01A))
ADEX$colspan_trt <- factor(ifelse(ADEX$TRT01A == "Placebo", " ", "Active Study Agent"),
levels = c("Active Study Agent", " ")
)
ADEX$diff_header <- "Difference in Means (95% CI)"
ADEX$diff_label <- paste(ADEX$TRT01A, paste("vs", "Placebo"))
colspan_trt_map <- create_colspan_map(ADEX,
non_active_grp = "Placebo",
non_active_grp_span_lbl = " ",
active_grp_span_lbl = "Active Study Agent",
colspan_var = "colspan_trt",
trt_var = "TRT01A"
)
ref_path <- c("colspan_trt", "", "TRT01A", "Placebo")
lyt <- basic_table() |>
split_cols_by(
"colspan_trt",
split_fun = trim_levels_to_map(map = colspan_trt_map)
) |>
split_cols_by("TRT01A") |>
split_cols_by("diff_header", nested = FALSE) |>
split_cols_by(
"TRT01A",
split_fun = remove_split_levels("Placebo"),
labels_var = "diff_label"
) |>
analyze("AVAL",
afun = a_summarize_ex_j, var_labels = "Duration of treatment (Days)",
show_labels = "visible",
indent_mod = 0L,
extra_args = list(
daysconv = 1,
ref_path = ref_path,
variables = list(arm = "TRT01A", covariates = NULL),
ancova = TRUE,
comp_btw_group = TRUE
)
)
result <- build_table(lyt, ADEX)
result