Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decorators: Accepts new snapshot from testthat::test() #1304

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions tests/testthat/_snaps/tm_a_gee.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand All @@ -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
}


Expand All @@ -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
}


Expand All @@ -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
}


10 changes: 4 additions & 6 deletions tests/testthat/_snaps/tm_a_mmrm.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand All @@ -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
}


Expand Down
12 changes: 4 additions & 8 deletions tests/testthat/_snaps/tm_g_ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
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)) +
ggplot2::labs(title = "Confidence Interval Plot by Treatment Group",
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)
Expand All @@ -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)) +
Expand All @@ -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
Expand All @@ -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)) +
Expand All @@ -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
Expand All @@ -57,14 +54,13 @@
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)) +
ggplot2::labs(title = "Confidence Interval Plot by Treatment Group",
caption = "Mean and 90% CIs for mean are displayed.",
x = "Treatment Group", y = "Value", color = "", lty = "",
shape = "")
print(gg)
}

4 changes: 2 additions & 2 deletions tests/testthat/_snaps/tm_g_forest_rsp.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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))

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/tm_g_forest_tte.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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))

Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/_snaps/tm_g_km.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand Down Expand Up @@ -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
}


Expand Down Expand Up @@ -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
}


2 changes: 0 additions & 2 deletions tests/testthat/_snaps/tm_g_lineplot.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand Down Expand Up @@ -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
}


9 changes: 3 additions & 6 deletions tests/testthat/_snaps/tm_t_abnormality.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand Down Expand Up @@ -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
}


Expand Down Expand Up @@ -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
}


6 changes: 2 additions & 4 deletions tests/testthat/_snaps/tm_t_abnormality_by_worst_grade.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}


Expand Down Expand Up @@ -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)
}


21 changes: 7 additions & 14 deletions tests/testthat/_snaps/tm_t_ancova.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}


Expand Down Expand Up @@ -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)
}


Expand Down Expand Up @@ -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)
}


Expand Down Expand Up @@ -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)
}


Expand Down Expand Up @@ -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)
}


Expand Down Expand Up @@ -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)
}


Expand Down Expand Up @@ -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)
}


Loading
Loading