a_summarize_aval_chg_diff_j {junco} | R Documentation |
Analysis function 3-column presentation
Description
Analysis functions to produce a 1-row summary presented in
a 3-column layout in the columns: column 1: N, column 2: Value, column 3: change
In the difference columns, only 1 column will be presented : difference + CI
When ancova = TRUE
, the presented statistics will be based on ANCOVA method (s_summarize_ancova_j
).
mean and ci (both for Value (column 2) and Chg (column 3)) using statistic lsmean_ci
mean and ci for the difference column are based on same ANCOVA model using statistic lsmean_diffci
When ancova = FALSE
, descriptive statistics will be used instead.
In the difference column, the 2-sample t-test will be used.
Usage
a_summarize_aval_chg_diff_j(
df,
.df_row,
.spl_context,
ancova = FALSE,
comp_btw_group = TRUE,
ref_path = NULL,
.N_col,
denom = c("N", ".N_col"),
indatavar = NULL,
d = 0,
id = "USUBJID",
interaction_y = FALSE,
interaction_item = NULL,
conf_level = 0.95,
variables = list(arm = "TRT01A", covariates = NULL),
format_na_str = "",
.stats = list(col1 = "count_denom_frac", col23 = "mean_ci_3d", coldiff =
"meandiff_ci_3d"),
.formats = list(col1 = NULL, col23 = "xx.dx (xx.dx, xx.dx)", coldiff =
"xx.dx (xx.dx, xx.dx)"),
.formats_fun = list(col1 = jjcsformat_count_denom_fraction, col23 = jjcsformat_xx,
coldiff = jjcsformat_xx),
multivars = c("AVAL", "AVAL", "CHG")
)
Arguments
df |
( |
.df_row |
( |
.spl_context |
( |
ancova |
( |
comp_btw_group |
( |
ref_path |
( |
.N_col |
( |
denom |
(
|
indatavar |
( |
d |
(default = 1)
|
id |
( |
interaction_y |
( |
interaction_item |
( |
conf_level |
( |
variables |
(named list of strings)
|
format_na_str |
( |
.stats |
(named |
.formats |
(named |
.formats_fun |
(named |
multivars |
( |
Details
See Description
Value
A function that can be used in an analyze function call
See Also
s_summarize_ancova_j
Other Inclusion of ANCOVA Functions:
a_summarize_ancova_j()
,
s_ancova_j()
Examples
library(dplyr)
ADEG <- data.frame(
STUDYID = c(
"DUMMY", "DUMMY", "DUMMY", "DUMMY", "DUMMY",
"DUMMY", "DUMMY", "DUMMY", "DUMMY", "DUMMY"
),
USUBJID = c(
"XXXXX01", "XXXXX02", "XXXXX03", "XXXXX04", "XXXXX05",
"XXXXX06", "XXXXX07", "XXXXX08", "XXXXX09", "XXXXX10"
),
TRT01A = c(
"ARMA", "ARMA", "ARMA", "ARMA", "ARMA", "Placebo",
"Placebo", "Placebo", "ARMA", "ARMA"
),
PARAM = c("BP", "BP", "BP", "BP", "BP", "BP", "BP", "BP", "BP", "BP"),
AVISIT = c(
"Visit 1", "Visit 1", "Visit 1", "Visit 1", "Visit 1",
"Visit 1", "Visit 1", "Visit 1", "Visit 1", "Visit 1"
),
AVAL = c(56, 78, 67, 87, 88, 93, 39, 87, 65, 55),
CHG = c(2, 3, -1, 9, -2, 0, 6, -2, 5, 2)
)
ADEG <- ADEG |>
mutate(
TRT01A = as.factor(TRT01A),
STUDYID = as.factor(STUDYID)
)
ADEG$colspan_trt <- factor(ifelse(ADEG$TRT01A == "Placebo", " ", "Active Study Agent"),
levels = c("Active Study Agent", " ")
)
ADEG$rrisk_header <- "Risk Difference (%) (95% CI)"
ADEG$rrisk_label <- paste(ADEG$TRT01A, paste("vs", "Placebo"))
colspan_trt_map <- create_colspan_map(ADEG,
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_rows_by(
"PARAM",
label_pos = "topleft",
split_label = "Blood Pressure",
section_div = " ",
split_fun = drop_split_levels
) |>
split_rows_by(
"AVISIT",
label_pos = "topleft",
split_label = "Study Visit",
split_fun = drop_split_levels,
child_labels = "hidden"
) |>
split_cols_by_multivar(
c("AVAL", "AVAL", "CHG"),
varlabels = c("n/N (%)", "Mean (CI)", "CFB (CI)")
) |>
split_cols_by("rrisk_header", nested = FALSE) |>
split_cols_by(
"TRT01A",
split_fun = remove_split_levels("Placebo"),
labels_var = "rrisk_label"
) |>
split_cols_by_multivar(c("CHG"), varlabels = c(" ")) |>
analyze("STUDYID",
afun = a_summarize_aval_chg_diff_j,
extra_args = list(
format_na_str = "-", d = 0,
ref_path = ref_path, variables = list(arm = "TRT01A", covariates = NULL)
)
)
result <- build_table(lyt, ADEG)
result