Skip to content

Commit

Permalink
Replace summarize_vars usage with analyze_vars (#114)
Browse files Browse the repository at this point in the history
Closes #113
  • Loading branch information
edelarua authored Sep 8, 2023
1 parent 6bad07b commit f5296f6
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 62 deletions.
2 changes: 1 addition & 1 deletion book/graphs/other/cig01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ The corresponding table is simply obtained using the `rtables` framework:
```{r table6, test = list(table_v6 = "table")}
lyt <- basic_table() %>%
split_cols_by(var = "ARMCD") %>%
summarize_vars(vars = "AVAL", .stats = c("mean_sd", "median"))
analyze_vars(vars = "AVAL", .stats = c("mean_sd", "median"))
table <- build_table(lyt = lyt, df = adlb)
table
```
Expand Down
2 changes: 1 addition & 1 deletion book/graphs/other/mng01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ plot
plot <- g_lineplot(
df = adlb_f,
alt_counts_df = adsl_f,
control = control_summarize_vars(conf_level = 0.80),
control = control_analyze_vars(conf_level = 0.80),
title = "Plot of Mean and 80% Confidence Limits by Visit",
subtitle = "Laboratory Test:"
)
Expand Down
8 changes: 4 additions & 4 deletions book/tables/adverse-events/aet04_pi.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ full_table_aet04_pi <- function(adsl, adae_max) {
.stats = "unique",
.labels = "Total number of patients with at least one adverse event"
) %>%
summarize_vars(
analyze_vars(
"AEDECOD",
na.rm = FALSE,
denom = "N_col",
Expand Down Expand Up @@ -241,7 +241,7 @@ full_table <- basic_table() %>%
.stats = "unique",
.labels = "Total number of patients with at least one adverse event"
) %>%
summarize_vars(
analyze_vars(
"AEDECOD",
na.rm = FALSE,
denom = "N_col",
Expand Down Expand Up @@ -298,7 +298,7 @@ full_table <- basic_table() %>%
.stats = "unique",
.labels = "Total number of patients with at least one adverse event"
) %>%
summarize_vars(
analyze_vars(
"AEDECOD",
na.rm = FALSE,
denom = "N_col",
Expand Down Expand Up @@ -345,7 +345,7 @@ col_counts <- rep(table(adsl$ACTARM), each = length(grade_groups))
full_table <- basic_table() %>%
split_cols_by("ACTARM") %>%
split_cols_by_groups("MAXAETOXGR", groups = grade_groups) %>%
summarize_vars(
analyze_vars(
"AEDECOD",
na.rm = FALSE,
denom = "N_col",
Expand Down
16 changes: 8 additions & 8 deletions book/tables/efficacy/dort01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
.labels = "Responders",
.stats = "count"
) %>%
summarize_vars(
analyze_vars(
vars = "is_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Responders with subsequent event (%)"),
Expand All @@ -68,7 +68,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
indent_mod = 2L,
) %>%
analyze("EVNTDESC") %>%
summarize_vars(
analyze_vars(
vars = "is_not_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Responders without subsequent event (%)"),
Expand Down Expand Up @@ -105,7 +105,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
.labels = "Responders",
.stats = "count"
) %>%
summarize_vars(
analyze_vars(
vars = "is_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Responders with subsequent event (%)"),
Expand All @@ -121,7 +121,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
indent_mod = 2L,
) %>%
analyze("EVNTDESC") %>%
summarize_vars(
analyze_vars(
vars = "is_not_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Responders without subsequent event (%)"),
Expand Down Expand Up @@ -160,7 +160,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
.labels = "Responders",
.stats = "count"
) %>%
summarize_vars(
analyze_vars(
vars = "is_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Responders with subsequent event (%)"),
Expand All @@ -176,7 +176,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
indent_mod = 2L,
) %>%
analyze("EVNTDESC") %>%
summarize_vars(
analyze_vars(
vars = "is_not_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Responders without subsequent event (%)"),
Expand Down Expand Up @@ -215,7 +215,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
.labels = "Responders",
.stats = "count"
) %>%
summarize_vars(
analyze_vars(
vars = "is_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Responders with subsequent event (%)"),
Expand All @@ -231,7 +231,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
indent_mod = 2L,
) %>%
analyze("EVNTDESC") %>%
summarize_vars(
analyze_vars(
vars = "is_not_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Responders without subsequent event (%)"),
Expand Down
2 changes: 1 addition & 1 deletion book/tables/efficacy/mmrmt01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ baseline_dat <- adqs %>%
b <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ARMCD") %>%
split_rows_by("AVISIT") %>%
summarize_vars("AVAL") %>%
analyze_vars("AVAL") %>%
append_topleft(" Statistics") %>%
build_table(baseline_dat, alt_counts_df = adsl_sub)
Expand Down
24 changes: 12 additions & 12 deletions book/tables/efficacy/ttet01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(
var = "ARM", ref_group = "A: Drug X"
) %>%
summarize_vars(
analyze_vars(
vars = "is_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients with event (%)")
Expand All @@ -62,7 +62,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
indent_mod = 1L,
) %>%
analyze("EVNTDESC") %>%
summarize_vars(
analyze_vars(
vars = "is_not_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients without event (%)"),
Expand Down Expand Up @@ -102,12 +102,12 @@ result
```{r variant2, test = list(result_v2 = "result")}
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ARM", ref_group = "A: Drug X") %>%
summarize_vars(
analyze_vars(
vars = "is_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients with event (%)")
) %>%
summarize_vars(
analyze_vars(
"is_not_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients without event (%)"),
Expand Down Expand Up @@ -144,7 +144,7 @@ result
```{r variant3, test = list(result_v3 = "result")}
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ARM", ref_group = "A: Drug X") %>%
summarize_vars(
analyze_vars(
vars = "is_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients with event (%)")
Expand All @@ -158,7 +158,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
indent_mod = 1L,
) %>%
analyze("EVNTDESC") %>%
summarize_vars(
analyze_vars(
vars = "is_not_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients without event (%)"),
Expand Down Expand Up @@ -212,7 +212,7 @@ result
```{r variant4, test = list(result_v4 = "result")}
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ARM", ref_group = "A: Drug X") %>%
summarize_vars(
analyze_vars(
vars = "is_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients with event (%)")
Expand All @@ -226,7 +226,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
indent_mod = 1L,
) %>%
analyze("EVNTDESC") %>%
summarize_vars(
analyze_vars(
vars = "is_not_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients without event (%)"),
Expand Down Expand Up @@ -271,7 +271,7 @@ result
```{r variant5, test = list(result_v5 = "result")}
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ARM", ref_group = "A: Drug X") %>%
summarize_vars(
analyze_vars(
vars = "is_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients with event (%)")
Expand All @@ -285,7 +285,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
indent_mod = 1L,
) %>%
analyze("EVNTDESC") %>%
summarize_vars(
analyze_vars(
vars = "is_not_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients without event (%)"),
Expand Down Expand Up @@ -324,7 +324,7 @@ result
```{r variant6, test = list(result_v6 = "result")}
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ARM", ref_group = "A: Drug X") %>%
summarize_vars(
analyze_vars(
vars = "is_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients with event (%)")
Expand All @@ -338,7 +338,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
indent_mod = 1L,
) %>%
analyze("EVNTDESC") %>%
summarize_vars(
analyze_vars(
vars = "is_not_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients without event (%)"),
Expand Down
2 changes: 1 addition & 1 deletion book/tables/lab-results/lbt02.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ l <- basic_table(show_colcounts = TRUE) %>%
label_pos = "topleft",
split_label = obj_label(adlb$AVISIT)
) %>%
summarize_vars(vars = "AVAL")
analyze_vars(vars = "AVAL")
result <- build_table(l,
df = adlb,
Expand Down
6 changes: 3 additions & 3 deletions book/tables/other/disclosurest01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ lyt <- basic_table(show_colcounts = TRUE) %>%
split_fun = split_fun
) %>%
summarize_row_groups(label_fstr = "Discontinued Study") %>%
summarize_vars(
analyze_vars(
"STDDRS",
.stats = "count_fraction"
) %>%
Expand Down Expand Up @@ -166,7 +166,7 @@ var_labels <- c("Age (yr)", "Age group", "Sex", "Race", "Ethnicity")
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ARM") %>%
add_overall_col("All Patients") %>%
summarize_vars(
analyze_vars(
vars = vars,
var_labels = var_labels
)
Expand Down Expand Up @@ -203,7 +203,7 @@ var_labels(adsl) <- c(adsl_labels)
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ARM") %>%
add_overall_col(label = "All Patients") %>%
summarize_vars("COUNTRY") %>%
analyze_vars("COUNTRY") %>%
append_varlabels(adsl, "COUNTRY")
result <- build_table(lyt, adsl)
Expand Down
2 changes: 1 addition & 1 deletion book/tables/other/ratet01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ anl <- df_explicit_na(anl)
```{r variant1, test = list(result_v1 = "result")}
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ARM", ref_group = "B: Placebo") %>%
summarize_vars(
analyze_vars(
"AVAL_f",
var_labels = "Number of exacerbations per patient",
.stats = c("count_fraction"),
Expand Down
4 changes: 2 additions & 2 deletions book/tables/pharmacokinetic/adat02.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ lyt_adab_ti <- basic_table(show_colcounts = TRUE) %>%
var_labels = "Treatment-induced ADA patients with",
show_labels = "visible"
) %>%
summarize_vars(
analyze_vars(
"Time to onset of ADA",
.stats = "median",
nested = FALSE,
.labels = c(median = "Median time to onset of ADA (weeks)")
) %>%
summarize_vars(
analyze_vars(
"Antibody titer units",
.stats = "range",
nested = FALSE,
Expand Down
2 changes: 1 addition & 1 deletion book/tables/pharmacokinetic/pkpt02.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ lyt <- basic_table() %>%
label_pos = "topleft",
split_label = "PK Parameter"
) %>%
tern::summarize_vars(
tern::analyze_vars(
vars = "AVAL",
.stats = c("n", "mean_sd", "cv", "geom_mean", "geom_cv", "median", "range"),
.formats = c(
Expand Down
2 changes: 1 addition & 1 deletion book/tables/pharmacokinetic/pkpt04.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ lyt <- basic_table() %>%
label_pos = "topleft",
split_label = "PK Parameter"
) %>%
tern::summarize_vars(
tern::analyze_vars(
vars = "AVAL",
.stats = c("n", "mean_sd", "cv", "geom_mean", "geom_cv", "median", "range"),
.formats = c(
Expand Down
2 changes: 1 addition & 1 deletion book/tables/pharmacokinetic/pkpt06.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ lyt <- basic_table() %>%
label_pos = "topleft",
split_label = "PK Parameter"
) %>%
tern::summarize_vars(
tern::analyze_vars(
vars = "AVAL",
.stats = c("n", "mean_sd", "cv", "geom_mean", "geom_cv", "median", "range"),
.formats = c(
Expand Down
2 changes: 1 addition & 1 deletion book/tables/pharmacokinetic/pkpt08.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ lyt <- basic_table() %>%
label_pos = "topleft",
split_label = "Treatment Arm"
) %>%
summarize_vars(
analyze_vars(
vars = "AVAL",
.stats = c(
"n", "mean", "sd", "cv",
Expand Down
12 changes: 6 additions & 6 deletions book/tables/safety/dmt01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ var_labels <- c(
result <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ACTARM") %>%
add_overall_col("All Patients") %>%
summarize_vars(
analyze_vars(
vars = vars,
var_labels = var_labels
) %>%
Expand All @@ -125,7 +125,7 @@ var_labels <- c(
result <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ACTARM") %>%
summarize_vars(
analyze_vars(
vars = vars,
var_labels = var_labels
) %>%
Expand All @@ -141,14 +141,14 @@ split_fun <- drop_split_levels
result <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ACTARM") %>%
summarize_vars(
analyze_vars(
vars = c("AGE", "SEX", "RACE"),
var_labels = c("Age", "Sex", "Race")
) %>%
split_rows_by("STRATA1",
split_fun = split_fun
) %>%
summarize_vars("BMRKR1") %>%
analyze_vars("BMRKR1") %>%
build_table(adsl)
result
Expand All @@ -159,7 +159,7 @@ result
```{r variant4, test = list(result_v4 = "result")}
result <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ACTARM") %>%
summarize_vars(
analyze_vars(
vars = c("AGE", "SEX", "RACE", "DBP", "SBP"),
var_labels = c(
"Age (yr)",
Expand All @@ -179,7 +179,7 @@ result
```{r variant5, test = list(result_v5 = "result")}
result <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ACTARM") %>%
summarize_vars(
analyze_vars(
vars = c("AGE", "SEX", "RACE", "BBMISI"),
var_labels = c(
"Age (yr)",
Expand Down
Loading

0 comments on commit f5296f6

Please sign in to comment.