diff --git a/tests/testthat/_snaps/tm_a_gee.md b/tests/testthat/_snaps/tm_a_gee.md index 54b672ec8..d081d2600 100644 --- a/tests/testthat/_snaps/tm_a_gee.md +++ b/tests/testthat/_snaps/tm_a_gee.md @@ -13,9 +13,9 @@ $table { - result_table <- tern.gee::as.rtable(model_fit, type = "cov") - subtitles(result_table) <- NULL - main_footer(result_table) <- NULL + table <- tern.gee::as.rtable(model_fit, type = "cov") + subtitles(table) <- NULL + main_footer(table) <- NULL } @@ -34,9 +34,9 @@ $table { - result_table <- tern.gee::as.rtable(data.frame(Coefficient = model_fit$coefficients)) - subtitles(result_table) <- NULL - main_footer(result_table) <- NULL + table <- tern.gee::as.rtable(data.frame(Coefficient = model_fit$coefficients)) + subtitles(table) <- NULL + main_footer(table) <- NULL } @@ -56,13 +56,12 @@ $table { lsmeans_fit_model <- tern.gee::lsmeans(model_fit, 0.95) - result_table <- rtables::basic_table(show_colcounts = TRUE) %>% + table <- rtables::basic_table(show_colcounts = TRUE) %>% rtables::split_cols_by(var = "ARM", ref_group = model_fit$ref_level) %>% tern.gee::summarize_gee_logistic() %>% rtables::build_table(df = lsmeans_fit_model, alt_counts_df = ANL_ADSL) - subtitles(result_table) <- NULL - main_footer(result_table) <- NULL - result_table + subtitles(table) <- NULL + main_footer(table) <- NULL } @@ -82,13 +81,12 @@ $table { lsmeans_fit_model <- tern.gee::lsmeans(model_fit, 0.95) - result_table <- rtables::basic_table(show_colcounts = TRUE) %>% + table <- rtables::basic_table(show_colcounts = TRUE) %>% rtables::split_cols_by(var = "ARM", ref_group = model_fit$ref_level) %>% tern.gee::summarize_gee_logistic() %>% rtables::build_table(df = lsmeans_fit_model, alt_counts_df = ANL_ADSL) - subtitles(result_table) <- NULL - main_footer(result_table) <- NULL - result_table + subtitles(table) <- NULL + main_footer(table) <- NULL } diff --git a/tests/testthat/_snaps/tm_a_mmrm.md b/tests/testthat/_snaps/tm_a_mmrm.md index f03e7915f..f48062007 100644 --- a/tests/testthat/_snaps/tm_a_mmrm.md +++ b/tests/testthat/_snaps/tm_a_mmrm.md @@ -62,9 +62,8 @@ $cov_matrix { - cov_matrix <- tern.mmrm::as.rtable(fit_mmrm, type = "cov") - subtitles(cov_matrix) <- NULL - cov_matrix + covariance_table <- tern.mmrm::as.rtable(fit_mmrm, type = "cov") + subtitles(covariance_table) <- NULL } @@ -80,9 +79,8 @@ $cov_matrix { - cov_matrix <- tern.mmrm::as.rtable(fit_mmrm, type = "cov") - subtitles(cov_matrix) <- NULL - cov_matrix + covariance_table <- tern.mmrm::as.rtable(fit_mmrm, type = "cov") + subtitles(covariance_table) <- NULL } diff --git a/tests/testthat/_snaps/tm_g_ci.md b/tests/testthat/_snaps/tm_g_ci.md index 87b69c425..6c394bdc1 100644 --- a/tests/testthat/_snaps/tm_g_ci.md +++ b/tests/testthat/_snaps/tm_g_ci.md @@ -4,7 +4,7 @@ res Output { - gg <- ggplot2::ggplot(data = ANL, mapping = ggplot2::aes(x = ARMCD, + plot <- ggplot2::ggplot(data = ANL, mapping = ggplot2::aes(x = ARMCD, y = AVAL, color = SEX, lty = SEX, shape = SEX)) + ggplot2::stat_summary(fun.data = stat_mean_ci, geom = "errorbar", width = 0.1, position = ggplot2::position_dodge(width = 0.5)) + ggplot2::stat_summary(fun = mean, geom = "point", position = ggplot2::position_dodge(width = 0.5)) + @@ -12,7 +12,6 @@ caption = "Mean and 95% CIs for mean are displayed.", x = "Treatment Group", y = "Value", color = "", lty = "", shape = "") - print(gg) } # 3. Confidence Interval Plot (using different stratification variable) @@ -21,7 +20,7 @@ res Output { - gg <- ggplot2::ggplot(data = ANL, mapping = ggplot2::aes(x = ARMCD, + plot <- ggplot2::ggplot(data = ANL, mapping = ggplot2::aes(x = ARMCD, y = AVAL, color = STRATA2, lty = STRATA2, shape = STRATA2)) + ggplot2::stat_summary(fun.data = stat_mean_ci, geom = "errorbar", width = 0.1, position = ggplot2::position_dodge(width = 0.5)) + @@ -30,7 +29,6 @@ caption = "Mean and 95% CIs for mean are displayed.", x = "Treatment Group", y = "Value", color = "", lty = "", shape = "") - print(gg) } # 4. Median and 95% CIs for median @@ -39,7 +37,7 @@ res Output { - gg <- ggplot2::ggplot(data = ANL, mapping = ggplot2::aes(x = ARMCD, + plot <- ggplot2::ggplot(data = ANL, mapping = ggplot2::aes(x = ARMCD, y = AVAL, color = STRATA1, lty = STRATA1, shape = STRATA1)) + ggplot2::stat_summary(fun.data = stat_median_ci, geom = "errorbar", width = 0.1, position = ggplot2::position_dodge(width = 0.5)) + @@ -48,7 +46,6 @@ caption = "Median and 95% CIs for median are displayed.", x = "Treatment Group", y = "Value", color = "", lty = "", shape = "") - print(gg) } # 5. Using different alpha level @@ -57,7 +54,7 @@ res Output { - gg <- ggplot2::ggplot(data = ANL, mapping = ggplot2::aes(x = ARMCD, + plot <- ggplot2::ggplot(data = ANL, mapping = ggplot2::aes(x = ARMCD, y = AVAL, color = SEX, lty = SEX, shape = SEX)) + ggplot2::stat_summary(fun.data = function(x) stat_mean_ci(x, conf_level = 0.9), geom = "errorbar", width = 0.1, position = ggplot2::position_dodge(width = 0.5)) + ggplot2::stat_summary(fun = mean, geom = "point", position = ggplot2::position_dodge(width = 0.5)) + @@ -65,6 +62,5 @@ caption = "Mean and 90% CIs for mean are displayed.", x = "Treatment Group", y = "Value", color = "", lty = "", shape = "") - print(gg) } diff --git a/tests/testthat/_snaps/tm_g_forest_rsp.md b/tests/testthat/_snaps/tm_g_forest_rsp.md index 5a9daf5d7..8a238a190 100644 --- a/tests/testthat/_snaps/tm_g_forest_rsp.md +++ b/tests/testthat/_snaps/tm_g_forest_rsp.md @@ -35,7 +35,7 @@ as_list = TRUE) $plot[[2]] - p <- cowplot::plot_grid(f[["table"]] + ggplot2::labs(title = "Forest Plot of Best Overall Response for "), + plot <- cowplot::plot_grid(f[["table"]] + ggplot2::labs(title = "Forest Plot of Best Overall Response for "), f[["plot"]] + ggplot2::labs(caption = ""), align = "h", axis = "tblr", rel_widths = c(1 - 0.25, 0.25)) @@ -80,7 +80,7 @@ as_list = TRUE) $plot[[2]] - p <- cowplot::plot_grid(f[["table"]] + ggplot2::labs(title = "Forest Plot of Best Overall Response for "), + plot <- cowplot::plot_grid(f[["table"]] + ggplot2::labs(title = "Forest Plot of Best Overall Response for "), f[["plot"]] + ggplot2::labs(caption = ""), align = "h", axis = "tblr", rel_widths = c(1 - 0.25, 0.25)) diff --git a/tests/testthat/_snaps/tm_g_forest_tte.md b/tests/testthat/_snaps/tm_g_forest_tte.md index f7bcf257a..2f1c7e5b7 100644 --- a/tests/testthat/_snaps/tm_g_forest_tte.md +++ b/tests/testthat/_snaps/tm_g_forest_tte.md @@ -38,7 +38,7 @@ as_list = TRUE) $plot[[2]] - p <- cowplot::plot_grid(f[["table"]] + ggplot2::labs(title = "Forest Plot of Survival Duration for \nStratified by STRATA2", + plot <- cowplot::plot_grid(f[["table"]] + ggplot2::labs(title = "Forest Plot of Survival Duration for \nStratified by STRATA2", subtitle = NULL), f[["plot"]] + ggplot2::labs(caption = ""), align = "h", axis = "tblr", rel_widths = c(1 - 0.25, 0.25)) @@ -85,7 +85,7 @@ as_list = TRUE) $plot[[2]] - p <- cowplot::plot_grid(f[["table"]] + ggplot2::labs(title = "Forest Plot of Survival Duration for \nStratified by STRATA2", + plot <- cowplot::plot_grid(f[["table"]] + ggplot2::labs(title = "Forest Plot of Survival Duration for \nStratified by STRATA2", subtitle = NULL), f[["plot"]] + ggplot2::labs(caption = ""), align = "h", axis = "tblr", rel_widths = c(1 - 0.25, 0.25)) diff --git a/tests/testthat/_snaps/tm_g_km.md b/tests/testthat/_snaps/tm_g_km.md index 06fbb48cf..8011eba33 100644 --- a/tests/testthat/_snaps/tm_g_km.md +++ b/tests/testthat/_snaps/tm_g_km.md @@ -52,7 +52,6 @@ g_km_counter <- g_km_counter_generator() plot_list <- lapply(anl, g_km_counter) plot <- cowplot::plot_grid(plotlist = plot_list, ncol = 1) - plot } @@ -114,7 +113,6 @@ g_km_counter <- g_km_counter_generator() plot_list <- lapply(anl, g_km_counter) plot <- cowplot::plot_grid(plotlist = plot_list, ncol = 1) - plot } @@ -177,7 +175,6 @@ g_km_counter <- g_km_counter_generator() plot_list <- lapply(anl, g_km_counter) plot <- cowplot::plot_grid(plotlist = plot_list, ncol = 1) - plot } diff --git a/tests/testthat/_snaps/tm_g_lineplot.md b/tests/testthat/_snaps/tm_g_lineplot.md index 82e7977b3..ac91769eb 100644 --- a/tests/testthat/_snaps/tm_g_lineplot.md +++ b/tests/testthat/_snaps/tm_g_lineplot.md @@ -24,7 +24,6 @@ legend_title = NULL, ggtheme = ggplot2::theme_minimal(), control = control_analyze_vars(conf_level = 0.95), subtitle_add_paramcd = FALSE, subtitle_add_unit = FALSE) - plot } @@ -54,7 +53,6 @@ legend_title = NULL, ggtheme = ggplot2::theme_minimal(), control = control_analyze_vars(conf_level = 0.9), subtitle_add_paramcd = FALSE, subtitle_add_unit = FALSE) - plot } diff --git a/tests/testthat/_snaps/tm_t_abnormality.md b/tests/testthat/_snaps/tm_t_abnormality.md index 7218f4dab..711f3d7e2 100644 --- a/tests/testthat/_snaps/tm_t_abnormality.md +++ b/tests/testthat/_snaps/tm_t_abnormality.md @@ -38,9 +38,8 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) %>% + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) %>% rtables::prune_table() - result } @@ -83,9 +82,8 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) %>% + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) %>% rtables::prune_table() - result } @@ -129,9 +127,8 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) %>% + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) %>% rtables::prune_table() - result } diff --git a/tests/testthat/_snaps/tm_t_abnormality_by_worst_grade.md b/tests/testthat/_snaps/tm_t_abnormality_by_worst_grade.md index eb4b9b8f3..206160d2e 100644 --- a/tests/testthat/_snaps/tm_t_abnormality_by_worst_grade.md +++ b/tests/testthat/_snaps/tm_t_abnormality_by_worst_grade.md @@ -40,8 +40,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } @@ -87,8 +86,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = myadsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = myadsl) } diff --git a/tests/testthat/_snaps/tm_t_ancova.md b/tests/testthat/_snaps/tm_t_ancova.md index c465073a7..15ff96368 100644 --- a/tests/testthat/_snaps/tm_t_ancova.md +++ b/tests/testthat/_snaps/tm_t_ancova.md @@ -30,8 +30,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) } @@ -68,8 +67,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) } @@ -107,8 +105,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) } @@ -148,8 +145,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) } @@ -187,8 +183,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) } @@ -225,8 +220,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) } @@ -263,8 +257,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = adqs, alt_counts_df = adsl) } diff --git a/tests/testthat/_snaps/tm_t_binary_outcome.md b/tests/testthat/_snaps/tm_t_binary_outcome.md index 4e425de8d..100f127cf 100644 --- a/tests/testthat/_snaps/tm_t_binary_outcome.md +++ b/tests/testthat/_snaps/tm_t_binary_outcome.md @@ -31,8 +31,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } @@ -68,8 +67,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ADSL) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ADSL) } @@ -96,8 +94,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ADSL) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ADSL) } @@ -141,8 +138,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ADSL) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ADSL) } @@ -182,8 +178,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ADSL) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ADSL) } @@ -211,8 +206,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ADSL) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ADSL) } @@ -270,8 +264,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } diff --git a/tests/testthat/_snaps/tm_t_coxreg.md b/tests/testthat/_snaps/tm_t_coxreg.md index aacb9470f..35b47c9a5 100644 --- a/tests/testthat/_snaps/tm_t_coxreg.md +++ b/tests/testthat/_snaps/tm_t_coxreg.md @@ -25,7 +25,7 @@ "hr", "ci", "pval"), na_str = "") $table - result <- rtables::build_table(lyt = lyt, df = anl) + table <- rtables::build_table(lyt = lyt, df = anl) # template_coxreg generates correct univariate cox regression expressions with interactions @@ -55,7 +55,7 @@ "hr", "ci", "pval", "pval_inter"), na_str = "") $table - result <- rtables::build_table(lyt = lyt, df = anl) + table <- rtables::build_table(lyt = lyt, df = anl) # template_coxreg generates correct multivariate cox regression expressions @@ -85,8 +85,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl) - result + table <- rtables::build_table(lyt = lyt, df = anl) } diff --git a/tests/testthat/_snaps/tm_t_events.md b/tests/testthat/_snaps/tm_t_events.md index 7e9f4302a..a99064ad7 100644 --- a/tests/testthat/_snaps/tm_t_events.md +++ b/tests/testthat/_snaps/tm_t_events.md @@ -34,21 +34,21 @@ append_varlabels(adae, "AEDECOD", indent = 1L) $table - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) $prune { - pruned_result <- result %>% rtables::prune_table() + pruned_result <- rtables::prune_table(table) } $sort { - idx_split_col <- which(sapply(col_paths(result), tail, 1) == + idx_split_col <- which(sapply(col_paths(table), tail, 1) == "All Patients") pruned_and_sorted_result <- pruned_result %>% sort_at_path(path = c("AEBODSYS"), scorefun = cont_n_onecol(idx_split_col)) %>% sort_at_path(path = c("AEBODSYS", "*", "AEDECOD"), scorefun = score_occurrences_cols(col_indices = seq(1, - ncol(result)))) + ncol(table)))) pruned_and_sorted_result } @@ -94,21 +94,21 @@ append_varlabels(adae, "AEDECOD", indent = 1L) $table - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) $prune { - pruned_result <- result %>% rtables::prune_table() + pruned_result <- rtables::prune_table(table) } $sort { - idx_split_col <- which(sapply(col_paths(result), tail, 1) == + idx_split_col <- which(sapply(col_paths(table), tail, 1) == "All Patients") pruned_and_sorted_result <- pruned_result %>% sort_at_path(path = c("AEBODSYS"), scorefun = cont_n_onecol(idx_split_col)) %>% sort_at_path(path = c("AEBODSYS", "*", "AEDECOD"), scorefun = score_occurrences_cols(col_indices = seq(1, - ncol(result)))) + ncol(table)))) pruned_and_sorted_result } @@ -138,16 +138,16 @@ append_varlabels(adcm, "CMDECOD") $table - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) $prune { - pruned_result <- result %>% rtables::prune_table() + pruned_result <- rtables::prune_table(table) } $sort { - idx_split_col <- which(sapply(col_paths(result), tail, 1) == + idx_split_col <- which(sapply(col_paths(table), tail, 1) == "All Patients") pruned_and_sorted_result <- pruned_result %>% sort_at_path(path = c("CMDECOD"), scorefun = score_occurrences) @@ -193,11 +193,11 @@ append_varlabels(adae, "AEDECOD", indent = 1L) $table - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) $prune { - pruned_result <- result %>% rtables::prune_table() + pruned_result <- rtables::prune_table(table) } $sort @@ -243,12 +243,12 @@ append_varlabels(adae, "AEDECOD", indent = 1L) $table - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) $prune { - pruned_result <- result %>% rtables::prune_table() - col_indices <- 1:(ncol(result) - TRUE) + pruned_result <- rtables::prune_table(table) + col_indices <- 1:(ncol(table) - TRUE) row_condition <- has_fraction_in_any_col(atleast = 0.4, col_indices = col_indices) & has_fractions_difference(atleast = 0.1, col_indices = col_indices) pruned_result <- pruned_result %>% rtables::prune_table(keep_rows(row_condition)) @@ -256,12 +256,12 @@ $sort { - idx_split_col <- which(sapply(col_paths(result), tail, 1) == + idx_split_col <- which(sapply(col_paths(table), tail, 1) == "All Patients") pruned_and_sorted_result <- pruned_result %>% sort_at_path(path = c("AEBODSYS"), scorefun = cont_n_onecol(idx_split_col)) %>% sort_at_path(path = c("AEBODSYS", "*", "AEDECOD"), scorefun = score_occurrences_cols(col_indices = seq(1, - ncol(result)))) + ncol(table)))) criteria_fun <- function(tr) { inherits(tr, "ContentRow") } @@ -312,12 +312,12 @@ append_varlabels(adae, "AEDECOD", indent = 1L) $table - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) $prune { - pruned_result <- result %>% rtables::prune_table() - col_indices <- 1:(ncol(result) - TRUE) + pruned_result <- rtables::prune_table(table) + col_indices <- 1:(ncol(table) - TRUE) row_condition <- has_fraction_in_any_col(atleast = 0.4, col_indices = col_indices) & has_fractions_difference(atleast = 0.1, col_indices = col_indices) pruned_result <- pruned_result %>% rtables::prune_table(keep_rows(row_condition)) @@ -325,12 +325,12 @@ $sort { - idx_split_col <- which(sapply(col_paths(result), tail, 1) == + idx_split_col <- which(sapply(col_paths(table), tail, 1) == "All Patients") pruned_and_sorted_result <- pruned_result %>% sort_at_path(path = c("AEBODSYS"), scorefun = cont_n_onecol(idx_split_col)) %>% sort_at_path(path = c("AEBODSYS", "*", "AEDECOD"), scorefun = score_occurrences_cols(col_indices = seq(1, - ncol(result)))) + ncol(table)))) criteria_fun <- function(tr) { inherits(tr, "ContentRow") } diff --git a/tests/testthat/_snaps/tm_t_events_by_grade.md b/tests/testthat/_snaps/tm_t_events_by_grade.md index c16269577..030113353 100644 --- a/tests/testthat/_snaps/tm_t_events_by_grade.md +++ b/tests/testthat/_snaps/tm_t_events_by_grade.md @@ -50,7 +50,6 @@ 1), decreasing = TRUE) %>% sort_at_path(path = c("AEBODSYS", "*", "AEDECOD"), scorefun = cont_n_onecol(length(levels(adsl$ACTARM)) + 1), decreasing = TRUE) - pruned_and_sorted_result } @@ -110,7 +109,6 @@ 1), decreasing = TRUE) %>% sort_at_path(path = c("AEBODSYS", "*", "AEDECOD"), scorefun = cont_n_onecol(length(levels(adsl$ACTARM)) + 1), decreasing = TRUE) - pruned_and_sorted_result } @@ -162,7 +160,6 @@ pruned_and_sorted_result <- pruned_result %>% sort_at_path(path = "AEBODSYS", scorefun = cont_n_allcols, decreasing = TRUE) %>% sort_at_path(path = c("AEBODSYS", "*", "AEDECOD"), scorefun = cont_n_allcols, decreasing = TRUE) - pruned_and_sorted_result } @@ -212,7 +209,6 @@ pruned_and_sorted_result <- pruned_result %>% sort_at_path(path = "AEBODSYS", scorefun = cont_n_onecol(length(levels(adsl$ACTARM)) + 1), decreasing = TRUE) - pruned_and_sorted_result } @@ -279,7 +275,6 @@ col_indices = col_indices) pruned_and_sorted_result <- sorted_result %>% rtables::trim_rows(criteria = criteria_fun) %>% rtables::prune_table(keep_rows(at_least_percent_any)) - pruned_and_sorted_result } @@ -341,7 +336,6 @@ col_indices = col_indices) pruned_and_sorted_result <- sorted_result %>% rtables::trim_rows(criteria = criteria_fun) %>% rtables::prune_table(keep_rows(at_least_percent_any)) - pruned_and_sorted_result } @@ -401,7 +395,6 @@ col_indices = col_indices) pruned_and_sorted_result <- sorted_result %>% rtables::trim_rows(criteria = criteria_fun) %>% rtables::prune_table(keep_rows(at_least_percent_any)) - pruned_and_sorted_result } @@ -460,7 +453,6 @@ col_indices = col_indices) pruned_and_sorted_result <- sorted_result %>% rtables::trim_rows(criteria = criteria_fun) %>% rtables::prune_table(keep_rows(at_least_percent_any)) - pruned_and_sorted_result } diff --git a/tests/testthat/_snaps/tm_t_events_patyear.md b/tests/testthat/_snaps/tm_t_events_patyear.md index b6ef72e88..fbaa31bcf 100644 --- a/tests/testthat/_snaps/tm_t_events_patyear.md +++ b/tests/testthat/_snaps/tm_t_events_patyear.md @@ -23,8 +23,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } @@ -52,8 +51,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } @@ -87,8 +85,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } diff --git a/tests/testthat/_snaps/tm_t_events_summary.md b/tests/testthat/_snaps/tm_t_events_summary.md index 6a7334d7b..4e13d750b 100644 --- a/tests/testthat/_snaps/tm_t_events_summary.md +++ b/tests/testthat/_snaps/tm_t_events_summary.md @@ -28,7 +28,7 @@ .formats = c(count_fraction = format_count_fraction), denom = "N_col") $table_parent - result_parent <- rtables::build_table(lyt = lyt_parent, df = adsl, + table_parent <- rtables::build_table(lyt = lyt_parent, df = adsl, alt_counts_df = adsl) $layout_anl @@ -41,12 +41,12 @@ .labels = c(count = "Total AEs"), table_names = "total_aes") $table_anl - result_anl <- rtables::build_table(lyt = lyt_anl, df = anl, alt_counts_df = adsl) + table_anl <- rtables::build_table(lyt = lyt_anl, df = anl, alt_counts_df = adsl) $table { - rtables::col_info(result_parent) <- rtables::col_info(result_anl) - result <- rtables::rbind(result_anl, result_parent) + rtables::col_info(table_parent) <- rtables::col_info(table_anl) + table <- rtables::rbind(table_anl, table_parent) } @@ -79,7 +79,7 @@ rtables::split_cols_by(var = "ARM") %>% rtables::add_overall_col(label = "All Patients") $table_parent - result_parent <- rtables::build_table(lyt = lyt_parent, df = adsl, + table_parent <- rtables::build_table(lyt = lyt_parent, df = adsl, alt_counts_df = adsl) $layout_anl @@ -114,12 +114,12 @@ show_labels = "visible") $table_anl - result_anl <- rtables::build_table(lyt = lyt_anl, df = anl, alt_counts_df = adsl) + table_anl <- rtables::build_table(lyt = lyt_anl, df = anl, alt_counts_df = adsl) $table { - rtables::col_info(result_parent) <- rtables::col_info(result_anl) - result <- rtables::rbind(result_anl[1:2, ], result_anl[3:nrow(result_anl), + rtables::col_info(table_parent) <- rtables::col_info(table_anl) + table <- rtables::rbind(table_anl[1:2, ], table_anl[3:nrow(table_anl), ]) } diff --git a/tests/testthat/_snaps/tm_t_exposure.md b/tests/testthat/_snaps/tm_t_exposure.md index f436b5704..02f54739b 100644 --- a/tests/testthat/_snaps/tm_t_exposure.md +++ b/tests/testthat/_snaps/tm_t_exposure.md @@ -26,8 +26,8 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - rtables::prune_table(result) + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) + table <- rtables::prune_table(table) } @@ -59,8 +59,8 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = myadsl) - rtables::prune_table(result) + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = myadsl) + table <- rtables::prune_table(table) } @@ -92,8 +92,8 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - rtables::prune_table(result) + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) + table <- rtables::prune_table(table) } diff --git a/tests/testthat/_snaps/tm_t_logisitic.md b/tests/testthat/_snaps/tm_t_logisitic.md index 9a1a99a81..e4e7ecae2 100644 --- a/tests/testthat/_snaps/tm_t_logisitic.md +++ b/tests/testthat/_snaps/tm_t_logisitic.md @@ -27,10 +27,9 @@ $table { - result <- rtables::basic_table(title = "Summary of Logistic Regression Analysis for Best Confirmed Overall Response by Investigator for CR Responders") %>% + table <- rtables::basic_table(title = "Summary of Logistic Regression Analysis for Best Confirmed Overall Response by Investigator for CR Responders") %>% summarize_logistic(conf_level = 0.95, drop_and_remove_str = "_NA_") %>% rtables::append_topleft("BESRSPI") %>% rtables::build_table(df = mod) - result } @@ -63,10 +62,9 @@ $table { - result <- rtables::basic_table(title = "Summary of Logistic Regression Analysis for Best Confirmed Overall Response by Investigator for CR Responders") %>% + table <- rtables::basic_table(title = "Summary of Logistic Regression Analysis for Best Confirmed Overall Response by Investigator for CR Responders") %>% summarize_logistic(conf_level = 0.95, drop_and_remove_str = "_NA_") %>% rtables::append_topleft("BESRSPI") %>% rtables::build_table(df = mod) - result } @@ -88,10 +86,9 @@ $table { - result <- rtables::basic_table(title = "Summary of Logistic Regression Analysis for Best Confirmed Overall Response by Investigator for CR Responders") %>% + table <- rtables::basic_table(title = "Summary of Logistic Regression Analysis for Best Confirmed Overall Response by Investigator for CR Responders") %>% summarize_logistic(conf_level = 0.95, drop_and_remove_str = "_NA_") %>% rtables::append_topleft("BESRSPI") %>% rtables::build_table(df = mod) - result } diff --git a/tests/testthat/_snaps/tm_t_mult_events.md b/tests/testthat/_snaps/tm_t_mult_events.md index fbf4492a7..0a825e6cb 100644 --- a/tests/testthat/_snaps/tm_t_mult_events.md +++ b/tests/testthat/_snaps/tm_t_mult_events.md @@ -43,8 +43,7 @@ $final_table { - result <- sorted_result - result + table <- sorted_result } @@ -95,8 +94,7 @@ $final_table { - result <- sorted_result - result + table <- sorted_result } @@ -151,8 +149,7 @@ $final_table { - result <- sorted_result - result + table <- sorted_result } @@ -211,8 +208,7 @@ $final_table { - result <- sorted_result - result + table <- sorted_result } @@ -256,8 +252,7 @@ $final_table { - result <- sorted_result - result + table <- sorted_result } @@ -306,8 +301,7 @@ $final_table { - result <- sorted_result - result + table <- sorted_result } diff --git a/tests/testthat/_snaps/tm_t_pp_medical_history.md b/tests/testthat/_snaps/tm_t_pp_medical_history.md index 50a9a80d2..997603bcc 100644 --- a/tests/testthat/_snaps/tm_t_pp_medical_history.md +++ b/tests/testthat/_snaps/tm_t_pp_medical_history.md @@ -11,12 +11,11 @@ dplyr::arrange(mhbodsys) %>% dplyr::mutate_if(is.character, as.factor) %>% dplyr::mutate_if(is.factor, function(x) explicit_na(x, "UNKNOWN")) %>% dplyr::distinct() %>% `colnames<-`(labels) - result <- rtables::basic_table() %>% rtables::split_cols_by_multivar(colnames(result_raw)[2:3]) %>% + table <- rtables::basic_table() %>% rtables::split_cols_by_multivar(colnames(result_raw)[2:3]) %>% rtables::split_rows_by(colnames(result_raw)[1], split_fun = rtables::drop_split_levels) %>% rtables::split_rows_by(colnames(result_raw)[2], split_fun = rtables::drop_split_levels, child_labels = "hidden") %>% rtables::analyze_colvars(function(x) x[seq_along(x)]) %>% rtables::build_table(result_raw) - main_title(result) <- paste("Patient ID:", NULL) - result + main_title(table) <- paste("Patient ID:", NULL) } diff --git a/tests/testthat/_snaps/tm_t_shift_by_arm.md b/tests/testthat/_snaps/tm_t_shift_by_arm.md index 31e8c262d..b37651019 100644 --- a/tests/testthat/_snaps/tm_t_shift_by_arm.md +++ b/tests/testthat/_snaps/tm_t_shift_by_arm.md @@ -22,8 +22,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = adeg) - result + table <- rtables::build_table(lyt = lyt, df = adeg) } @@ -51,8 +50,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = adeg) - result + table <- rtables::build_table(lyt = lyt, df = adeg) } @@ -80,8 +78,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = adeg) - result + table <- rtables::build_table(lyt = lyt, df = adeg) } diff --git a/tests/testthat/_snaps/tm_t_shift_by_arm_by_worst.md b/tests/testthat/_snaps/tm_t_shift_by_arm_by_worst.md index 137032875..c219c2245 100644 --- a/tests/testthat/_snaps/tm_t_shift_by_arm_by_worst.md +++ b/tests/testthat/_snaps/tm_t_shift_by_arm_by_worst.md @@ -22,8 +22,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = adeg) - result + table <- rtables::build_table(lyt = lyt, df = adeg) } @@ -52,8 +51,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = adeg) - result + table <- rtables::build_table(lyt = lyt, df = adeg) } @@ -81,8 +79,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = adeg) - result + table <- rtables::build_table(lyt = lyt, df = adeg) } diff --git a/tests/testthat/_snaps/tm_t_shift_by_grade.md b/tests/testthat/_snaps/tm_t_shift_by_grade.md index 5227edd6c..89a3f8c8c 100644 --- a/tests/testthat/_snaps/tm_t_shift_by_grade.md +++ b/tests/testthat/_snaps/tm_t_shift_by_grade.md @@ -53,9 +53,8 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) %>% + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) %>% rtables::prune_table() - result } @@ -114,9 +113,8 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) %>% + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) %>% rtables::prune_table() - result } diff --git a/tests/testthat/_snaps/tm_t_smq.md b/tests/testthat/_snaps/tm_t_smq.md index 33b82a9b2..83014b17f 100644 --- a/tests/testthat/_snaps/tm_t_smq.md +++ b/tests/testthat/_snaps/tm_t_smq.md @@ -52,8 +52,7 @@ all_zero <- function(tr) { !inherits(tr, "ContentRow") && rtables::all_zero_or_na(tr) } - pruned_and_sorted_result <- sorted_result %>% rtables::trim_rows(criteria = all_zero) - pruned_and_sorted_result + table <- sorted_result %>% rtables::trim_rows(criteria = all_zero) } @@ -107,8 +106,7 @@ all_zero <- function(tr) { !inherits(tr, "ContentRow") && rtables::all_zero_or_na(tr) } - pruned_and_sorted_result <- sorted_result %>% rtables::trim_rows(criteria = all_zero) - pruned_and_sorted_result + table <- sorted_result %>% rtables::trim_rows(criteria = all_zero) } diff --git a/tests/testthat/_snaps/tm_t_summary.md b/tests/testthat/_snaps/tm_t_summary.md index b62aabeca..6d406c046 100644 --- a/tests/testthat/_snaps/tm_t_summary.md +++ b/tests/testthat/_snaps/tm_t_summary.md @@ -24,8 +24,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } @@ -55,8 +54,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } @@ -91,8 +89,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } @@ -128,8 +125,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } @@ -163,8 +159,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } @@ -201,8 +196,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } diff --git a/tests/testthat/_snaps/tm_t_summary_by.md b/tests/testthat/_snaps/tm_t_summary_by.md index 41e7a9d90..e150e211d 100644 --- a/tests/testthat/_snaps/tm_t_summary_by.md +++ b/tests/testthat/_snaps/tm_t_summary_by.md @@ -29,8 +29,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } @@ -64,8 +63,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } @@ -107,8 +105,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } @@ -142,8 +139,7 @@ $table { - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) - result + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) } @@ -185,9 +181,8 @@ rvs <- unlist(unname(row_values(tr))) isTRUE(all(rvs == 0)) } - result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) %>% + table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl) %>% rtables::trim_rows(criteria = all_zero) - result } diff --git a/tests/testthat/_snaps/tm_t_tte.md b/tests/testthat/_snaps/tm_t_tte.md index b3621e75c..e51da0c8d 100644 --- a/tests/testthat/_snaps/tm_t_tte.md +++ b/tests/testthat/_snaps/tm_t_tte.md @@ -39,7 +39,6 @@ $table { table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ANL_ADSL) - table } @@ -84,7 +83,6 @@ $table { table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ANL_ADSL) - table } @@ -143,7 +141,6 @@ $table { table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ANL_ADSL) - table } @@ -199,7 +196,6 @@ $table { table <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = ANL_ADSL) - table }