From 75f142cc71a8f06e6d60010994294d86ab622f24 Mon Sep 17 00:00:00 2001 From: Frederik Aust Date: Wed, 27 Sep 2023 11:37:15 +0200 Subject: [PATCH] Fix failing tests. --- DESCRIPTION | 2 +- tests/testthat/test_apa_print_emm_lsm.R | 40 ++++++++++++------------- tests/testthat/test_apa_print_merMod.R | 6 ++-- tests/testthat/test_apa_results_table.R | 12 ++++---- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1d729796..252288f8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -38,7 +38,7 @@ Suggests: beeswarm, boot, car, - dplyr, + dplyr (>= 1.1.0), effectsize (>= 0.4.4), emmeans, ggforce, diff --git a/tests/testthat/test_apa_print_emm_lsm.R b/tests/testthat/test_apa_print_emm_lsm.R index de7306e4..023b118a 100644 --- a/tests/testthat/test_apa_print_emm_lsm.R +++ b/tests/testthat/test_apa_print_emm_lsm.R @@ -310,10 +310,10 @@ test_that( , labels = list( contrast = "Contrast" , estimate = "$\\Delta M$" - , conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Tukey(3)}$" + , conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Tukey(3)}$" , statistic = "$t$" , df = "$\\mathit{df}$" - , adj.p.value = "$p_\\mathrm{\\scriptsize Tukey(3)}$" + , adj.p.value = "$p_\\mathrm{\\scriptstyle Tukey(3)}$" ) , term_names = c("Neg_Neu", "Neg_Pos", "Neu_Pos") ) @@ -321,8 +321,8 @@ test_that( expect_apa_term( tw_me_pairs_emm_output , term = "Neg_Neu" - , estimate = "$\\Delta M = -1.10$, $95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Tukey(3)}$ $[-3.44, 1.24]$" - , statistic = "$t(8) = -1.34$, $p_\\mathrm{\\scriptsize Tukey(3)} = .413$" + , estimate = "$\\Delta M = -1.10$, $95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Tukey(3)}$ $[-3.44, 1.24]$" + , statistic = "$t(8) = -1.34$, $p_\\mathrm{\\scriptstyle Tukey(3)} = .413$" ) ## Custom contrast names @@ -670,8 +670,8 @@ test_that( expect_equal( variable_label(ow_me_emm_bonf_res$table[, c("conf.int", "adj.p.value")]) , list( - conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Bonferroni(3)}$" - , adj.p.value = "$p_\\mathrm{\\scriptsize Bonferroni(3)}$" + conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Bonferroni(3)}$" + , adj.p.value = "$p_\\mathrm{\\scriptstyle Bonferroni(3)}$" ) ) @@ -680,8 +680,8 @@ test_that( expect_equal( variable_label(ow_me_emm_tukey_res$table[, c("conf.int", "adj.p.value")]) , list( - conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Tukey(3)}$" - , adj.p.value = "$p_\\mathrm{\\scriptsize Tukey(3)}$" + conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Tukey(3)}$" + , adj.p.value = "$p_\\mathrm{\\scriptstyle Tukey(3)}$" ) ) @@ -690,8 +690,8 @@ test_that( expect_equal( variable_label(ow_me_emm_holm_res$table[, c("conf.int", "adj.p.value")]) , list( - conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Bonferroni(3)}$" - , adj.p.value = "$p_\\mathrm{\\scriptsize Holm(3)}$" + conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Bonferroni(3)}$" + , adj.p.value = "$p_\\mathrm{\\scriptstyle Holm(3)}$" ) ) @@ -700,8 +700,8 @@ test_that( expect_equal( variable_label(ow_me_emm_fdr_res$table[, c("conf.int", "adj.p.value")]) , list( - conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Bonferroni(3)}$" - , adj.p.value = "$p_\\mathrm{\\scriptsize FDR(3)}$" + conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Bonferroni(3)}$" + , adj.p.value = "$p_\\mathrm{\\scriptstyle FDR(3)}$" ) ) @@ -710,8 +710,8 @@ test_that( expect_equal( variable_label(ow_me_emm_dun_res$table[, c("conf.int", "adj.p.value")]) , list( - conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Dunnett(3)}$" - , adj.p.value = "$p_\\mathrm{\\scriptsize Dunnett(3)}$" + conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Dunnett(3)}$" + , adj.p.value = "$p_\\mathrm{\\scriptstyle Dunnett(3)}$" ) ) @@ -720,8 +720,8 @@ test_that( expect_equal( variable_label(ow_me_emm_scheffe_res$table[, c("conf.int", "adj.p.value")]) , list( - conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Scheff\\'e(3)}$" - , adj.p.value = "$p_\\mathrm{\\scriptsize Scheff\\'e(3)}$" + conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Scheff\\'e(3)}$" + , adj.p.value = "$p_\\mathrm{\\scriptstyle Scheff\\'e(3)}$" ) ) @@ -730,8 +730,8 @@ test_that( expect_equal( variable_label(ow_me_emm_scheffe_res$table[, c("conf.int", "adj.p.value")]) , list( - conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Scheff\\'e(3)}$" - , adj.p.value = "$p_\\mathrm{\\scriptsize Scheff\\'e(3)}$" + conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Scheff\\'e(3)}$" + , adj.p.value = "$p_\\mathrm{\\scriptstyle Scheff\\'e(3)}$" ) ) @@ -740,8 +740,8 @@ test_that( expect_equal( variable_label(ow_me_emm_scheffe_res$table[, c("conf.int", "adj.p.value")]) , list( - conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Scheff\\'e(2)}$" - , adj.p.value = "$p_\\mathrm{\\scriptsize Scheff\\'e(2)}$" + conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Scheff\\'e(2)}$" + , adj.p.value = "$p_\\mathrm{\\scriptstyle Scheff\\'e(2)}$" ) ) diff --git a/tests/testthat/test_apa_print_merMod.R b/tests/testthat/test_apa_print_merMod.R index 3bd1c0d1..e7222505 100644 --- a/tests/testthat/test_apa_print_merMod.R +++ b/tests/testthat/test_apa_print_merMod.R @@ -310,11 +310,11 @@ test_that( group<-c("intervention", "control","control","intervention","control") library("dplyr") - df<-data.frame(participant,group) %>% + df <- data.frame(participant,group) %>% group_by(participant,group) %>% - summarise(session=c("t1","t2","t3","t4")) %>% + reframe(session=c("t1","t2","t3","t4")) %>% group_by(participant, group, session) %>% - summarise(task=c("a","b")) %>% + reframe(task=c("a","b")) %>% ungroup() %>% mutate(errors=floor(runif(n=40,min=0,max=30))) diff --git a/tests/testthat/test_apa_results_table.R b/tests/testthat/test_apa_results_table.R index 87d76ea2..d8d52771 100644 --- a/tests/testthat/test_apa_results_table.R +++ b/tests/testthat/test_apa_results_table.R @@ -99,17 +99,17 @@ test_that( test_that( "print.apa_results_table()" , { - with( + x <- with( npk , t.test( - yield[N == "1"] - , yield[N == "2"] + yield[N == "0"] + , yield[N == "1"] , paired = TRUE ) - ) - x <- apa_print()$table + ) |> + apa_print() - print_apa_results_table <- capture_output(print(x)) + print_apa_results_table <- capture_output(print(x$table)) expect_identical( print_apa_results_table , "A data.frame with 5 labelled columns:\n\n estimate conf.int statistic df p.value\n1 -5.62 [-9.93, -1.31] -2.87 11 .015\n\nestimate : $M_D$ \nconf.int : 95\\\\% CI \nstatistic: $t$ \ndf : $\\\\mathit{df}$ \np.value : $p$ "