From fae2b7f8af1ce7530ecfaa5b488ef657b1f69aaf Mon Sep 17 00:00:00 2001 From: Emily de la Rua Date: Wed, 6 Dec 2023 11:19:47 -0500 Subject: [PATCH 1/2] Update snapshots for tables with referential footnotes --- tests/testthat/_snaps/table_lbt11.md | 15 ++++++------- tests/testthat/_snaps/table_lbt11_bl.md | 12 +++-------- tests/testthat/_snaps/table_ttet01.md | 28 +++++++------------------ 3 files changed, 16 insertions(+), 39 deletions(-) diff --git a/tests/testthat/_snaps/table_lbt11.md b/tests/testthat/_snaps/table_lbt11.md index 728196a1..2322231e 100644 --- a/tests/testthat/_snaps/table_lbt11.md +++ b/tests/testthat/_snaps/table_lbt11.md @@ -12,7 +12,7 @@ Median NA NA 728.0 95% CI NA (724.0, NA) NA 25% and 75%-ile 618.0, NA 724.0, NA 728.0, 728.0 - Range 1.0 to 731.0 {1} 1.0 to 728.0 {2} 1.0 to 728.0 {3} + Range 1.0 to 731.0 {1} 1.0 to 728.0 {1} 1.0 to 728.0 {2} Unstratified Analysis p-value (log-rank) 0.0295 0.1687 Hazard Ratio 0.43 0.58 @@ -20,8 +20,7 @@ ——————————————————————————————————————————————————————————————————————————————————————— {1} - Censored observations: range minimum & maximum - {2} - Censored observations: range minimum & maximum - {3} - Censored observation: range minimum + {2} - Censored observation: range minimum ——————————————————————————————————————————————————————————————————————————————————————— @@ -39,12 +38,11 @@ Median NA NA 728.0 95% CI NA (724.0, NA) NA 25% and 75%-ile 618.0, NA 724.0, NA 728.0, 728.0 - Range 1.0 to 731.0 {1} 1.0 to 728.0 {2} 1.0 to 728.0 {3} + Range 1.0 to 731.0 {1} 1.0 to 728.0 {1} 1.0 to 728.0 {2} ——————————————————————————————————————————————————————————————————————————————————————— {1} - Censored observations: range minimum & maximum - {2} - Censored observations: range minimum & maximum - {3} - Censored observation: range minimum + {2} - Censored observation: range minimum ——————————————————————————————————————————————————————————————————————————————————————— @@ -62,7 +60,7 @@ Median NA NA 728.0 95% CI NA (724.0, NA) NA 25% and 75%-ile 618.0, NA 724.0, NA 728.0, 728.0 - Range 1.0 to 731.0 {1} 1.0 to 728.0 {2} 1.0 to 728.0 {3} + Range 1.0 to 731.0 {1} 1.0 to 728.0 {1} 1.0 to 728.0 {2} Unstratified Analysis p-value (log-rank) 0.0295 0.1687 Hazard Ratio 0.43 0.58 @@ -74,8 +72,7 @@ ——————————————————————————————————————————————————————————————————————————————————————— {1} - Censored observations: range minimum & maximum - {2} - Censored observations: range minimum & maximum - {3} - Censored observation: range minimum + {2} - Censored observation: range minimum ——————————————————————————————————————————————————————————————————————————————————————— diff --git a/tests/testthat/_snaps/table_lbt11_bl.md b/tests/testthat/_snaps/table_lbt11_bl.md index 794d9a4e..1a68e49b 100644 --- a/tests/testthat/_snaps/table_lbt11_bl.md +++ b/tests/testthat/_snaps/table_lbt11_bl.md @@ -12,7 +12,7 @@ Median NA NA 721.0 95% CI NA (681.0, NA) (691.0, NA) 25% and 75%-ile 608.0, NA 558.0, NA 644.0, NA - Range 1.0 to 728.0 {1} 1.0 to 726.0 {2} 1.0 to 724.0 {3} + Range 1.0 to 728.0 {1} 1.0 to 726.0 {1} 1.0 to 724.0 {1} Unstratified Analysis p-value (log-rank) 0.5013 0.6413 Hazard Ratio 1.27 0.84 @@ -20,8 +20,6 @@ ——————————————————————————————————————————————————————————————————————————————————————— {1} - Censored observations: range minimum & maximum - {2} - Censored observations: range minimum & maximum - {3} - Censored observations: range minimum & maximum ——————————————————————————————————————————————————————————————————————————————————————— @@ -39,12 +37,10 @@ Median NA NA 721.0 95% CI NA (681.0, NA) (691.0, NA) 25% and 75%-ile 608.0, NA 558.0, NA 644.0, NA - Range 1.0 to 728.0 {1} 1.0 to 726.0 {2} 1.0 to 724.0 {3} + Range 1.0 to 728.0 {1} 1.0 to 726.0 {1} 1.0 to 724.0 {1} ——————————————————————————————————————————————————————————————————————————————————————— {1} - Censored observations: range minimum & maximum - {2} - Censored observations: range minimum & maximum - {3} - Censored observations: range minimum & maximum ——————————————————————————————————————————————————————————————————————————————————————— @@ -62,7 +58,7 @@ Median NA NA 721.0 95% CI NA (681.0, NA) (691.0, NA) 25% and 75%-ile 608.0, NA 558.0, NA 644.0, NA - Range 1.0 to 728.0 {1} 1.0 to 726.0 {2} 1.0 to 724.0 {3} + Range 1.0 to 728.0 {1} 1.0 to 726.0 {1} 1.0 to 724.0 {1} Unstratified Analysis p-value (log-rank) 0.5013 0.6413 Hazard Ratio 1.27 0.84 @@ -74,8 +70,6 @@ ——————————————————————————————————————————————————————————————————————————————————————— {1} - Censored observations: range minimum & maximum - {2} - Censored observations: range minimum & maximum - {3} - Censored observations: range minimum & maximum ——————————————————————————————————————————————————————————————————————————————————————— diff --git a/tests/testthat/_snaps/table_ttet01.md b/tests/testthat/_snaps/table_ttet01.md index 5928ffe7..188a3c37 100644 --- a/tests/testthat/_snaps/table_ttet01.md +++ b/tests/testthat/_snaps/table_ttet01.md @@ -14,7 +14,7 @@ Median NA NA 9.4 95% CI (9.3, NA) (9.4, NA) (7.6, NA) 25% and 75%-ile 5.6, NA 5.6, NA 5.0, NA - Range 0.5 to 16.4 {1} 0.9 to 16.3 {2} 0.5 to 16.3 {3} + Range 0.5 to 16.4 {1} 0.9 to 16.3 {1} 0.5 to 16.3 {1} Unstratified Analysis p-value (log-rank) 0.9998 0.1541 Hazard Ratio 1.00 1.29 @@ -36,8 +36,6 @@ ————————————————————————————————————————————————————————————————————————————————————— {1} - Censored observation: range maximum - {2} - Censored observation: range maximum - {3} - Censored observation: range maximum ————————————————————————————————————————————————————————————————————————————————————— @@ -57,7 +55,7 @@ Median NA 9.4 NA 95% CI (9.3, NA) (7.6, NA) (9.4, NA) 25% and 75%-ile 5.6, NA 5.0, NA 5.6, NA - Range 0.5 to 16.4 {1} 0.5 to 16.3 {2} 0.9 to 16.3 {3} + Range 0.5 to 16.4 {1} 0.5 to 16.3 {1} 0.9 to 16.3 {1} Unstratified Analysis p-value (log-rank) 0.9998 0.1480 Hazard Ratio 1.00 1.29 @@ -79,8 +77,6 @@ ————————————————————————————————————————————————————————————————————————————————————— {1} - Censored observation: range maximum - {2} - Censored observation: range maximum - {3} - Censored observation: range maximum ————————————————————————————————————————————————————————————————————————————————————— @@ -98,7 +94,7 @@ Median NA NA 9.4 95% CI (9.3, NA) (9.4, NA) (7.6, NA) 25% and 75%-ile 5.6, NA 5.6, NA 5.0, NA - Range 0.5 to 16.4 {1} 0.9 to 16.3 {2} 0.5 to 16.3 {3} + Range 0.5 to 16.4 {1} 0.9 to 16.3 {1} 0.5 to 16.3 {1} Unstratified Analysis p-value (log-rank) 0.9998 0.1541 Hazard Ratio 1.00 1.29 @@ -110,8 +106,6 @@ —————————————————————————————————————————————————————————————————————————————————— {1} - Censored observation: range maximum - {2} - Censored observation: range maximum - {3} - Censored observation: range maximum —————————————————————————————————————————————————————————————————————————————————— @@ -131,7 +125,7 @@ Median NA NA 9.4 90% CI (9.6, NA) (9.6, NA) (7.7, NA) 25% and 75%-ile 5.6, NA 5.6, NA 5.0, NA - Range 0.5 to 16.4 {1} 0.9 to 16.3 {2} 0.5 to 16.3 {3} + Range 0.5 to 16.4 {1} 0.9 to 16.3 {1} 0.5 to 16.3 {1} Unstratified Analysis p-value (log-rank) 0.9998 0.1541 Hazard Ratio 1.00 1.29 @@ -146,8 +140,6 @@ ——————————————————————————————————————————————————————————————————————————————————— {1} - Censored observation: range maximum - {2} - Censored observation: range maximum - {3} - Censored observation: range maximum ——————————————————————————————————————————————————————————————————————————————————— @@ -167,7 +159,7 @@ Median NA NA 9.4 95% CI (9.3, NA) (9.4, NA) (7.6, NA) 25% and 75%-ile 5.6, NA 5.6, NA 5.0, NA - Range 0.5 to 16.4 {1} 0.9 to 16.3 {2} 0.5 to 16.3 {3} + Range 0.5 to 16.4 {1} 0.9 to 16.3 {1} 0.5 to 16.3 {1} Unstratified Analysis p-value (log-rank) 0.9998 0.1541 Hazard Ratio 1.00 1.29 @@ -186,8 +178,6 @@ ————————————————————————————————————————————————————————————————————————————————————— {1} - Censored observation: range maximum - {2} - Censored observation: range maximum - {3} - Censored observation: range maximum ————————————————————————————————————————————————————————————————————————————————————— @@ -207,7 +197,7 @@ Median NA NA 9.4 95% CI (9.3, NA) (9.4, NA) (7.6, NA) 25% and 75%-ile 5.6, NA 5.6, NA 5.0, NA - Range 0.5 to 16.4 {1} 0.9 to 16.3 {2} 0.5 to 16.3 {3} + Range 0.5 to 16.4 {1} 0.9 to 16.3 {1} 0.5 to 16.3 {1} Unstratified Analysis p-value (log-rank) 0.9998 0.1541 Hazard Ratio 1.00 1.29 @@ -222,8 +212,6 @@ ————————————————————————————————————————————————————————————————————————————————————— {1} - Censored observation: range maximum - {2} - Censored observation: range maximum - {3} - Censored observation: range maximum ————————————————————————————————————————————————————————————————————————————————————— @@ -243,7 +231,7 @@ Median NA NA 9.4 95% CI (9.3, NA) (9.4, NA) (7.6, NA) 25% and 75%-ile 5.6, NA 5.6, NA 5.0, NA - Range 0.5 to 16.4 {1} 0.9 to 16.3 {2} 0.5 to 16.3 {3} + Range 0.5 to 16.4 {1} 0.9 to 16.3 {1} 0.5 to 16.3 {1} Unstratified Analysis p-value (log-rank) 0.9998 0.1541 p-value (wald) 0.9998 0.1552 @@ -260,8 +248,6 @@ ————————————————————————————————————————————————————————————————————————————————————— {1} - Censored observation: range maximum - {2} - Censored observation: range maximum - {3} - Censored observation: range maximum ————————————————————————————————————————————————————————————————————————————————————— From f45c034fd015f6ef7e8e3318de3f9ca26ec8c6e8 Mon Sep 17 00:00:00 2001 From: Emily de la Rua Date: Fri, 8 Dec 2023 18:33:34 -0500 Subject: [PATCH 2/2] Update dep versions --- DESCRIPTION | 12 ++++++------ tests/testthat/test-table_aet02.R | 4 ++-- tests/testthat/test-table_aet03.R | 6 +++--- tests/testthat/test-table_aet04.R | 12 ++++++------ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e13db2ae..8ceca45e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,14 +21,14 @@ License: Apache License 2.0 | file LICENSE URL: https://github.com/insightsengineering/scda.test/ BugReports: https://github.com/insightsengineering/scda.test/issues Depends: - formatters (>= 0.5.4.9002), + formatters (>= 0.5.5), R (>= 4.2), - rlistings (>= 0.2.6.9005), - rtables (>= 0.6.5.9004), - tern (>= 0.9.2.9001) + rlistings (>= 0.2.7), + rtables (>= 0.6.6), + tern (>= 0.9.3) Imports: - scda (>= 0.1.6.9012), - scda.2022 (>= 0.1.5.9002) + scda (>= 0.1.6.9013), + scda.2022 (>= 0.1.5.9003) Suggests: broom, checkmate, diff --git a/tests/testthat/test-table_aet02.R b/tests/testthat/test-table_aet02.R index 2ae3c537..e275de62 100644 --- a/tests/testthat/test-table_aet02.R +++ b/tests/testthat/test-table_aet02.R @@ -68,10 +68,10 @@ testthat::test_that("AET02 variant 1 is produced correctly", { # Testing pagination with not repeated Total number of patients pag_result <- paginate_table(result, cpp = 75) # std is 70 which fails testthat::expect_identical( - to_string_matrix(pag_result[[1]])[3, 1], + to_string_matrix(pag_result[[1]], with_spaces = FALSE)[3, 1], "Total number of patients with at least one adverse event" ) - testthat::expect_identical(to_string_matrix(pag_result[[2]])[5, 1], "cl A.1") + testthat::expect_identical(to_string_matrix(pag_result[[2]], with_spaces = FALSE)[5, 1], "cl A.1") }) testthat::test_that("AET02 variant 2 is produced correctly", { diff --git a/tests/testthat/test-table_aet03.R b/tests/testthat/test-table_aet03.R index bae053ea..f24f4577 100644 --- a/tests/testthat/test-table_aet03.R +++ b/tests/testthat/test-table_aet03.R @@ -76,7 +76,7 @@ testthat::test_that("AET03 variant 1 is produced correctly", { res <- testthat::expect_silent(result) testthat::expect_snapshot(res) - result_matrix <- to_string_matrix(result) + result_matrix <- to_string_matrix(result, with_spaces = FALSE) # Pagination also works (and sorting) lpp_test <- 18 @@ -94,11 +94,11 @@ testthat::test_that("AET03 variant 1 is produced correctly", { pag_result <- paginate_table(result, lpp = 16) testthat::expect_identical( - to_string_matrix(pag_result[[3]])[3, 1], + to_string_matrix(pag_result[[3]], with_spaces = FALSE)[3, 1], " Severity/Intensity" ) testthat::expect_identical( - to_string_matrix(pag_result[[1]])[3:4, 1], + to_string_matrix(pag_result[[1]], with_spaces = FALSE)[3:4, 1], c(" Severity/Intensity", "- Any Intensity -") ) }) diff --git a/tests/testthat/test-table_aet04.R b/tests/testthat/test-table_aet04.R index 5dab271c..f76a7a9e 100644 --- a/tests/testthat/test-table_aet04.R +++ b/tests/testthat/test-table_aet04.R @@ -111,11 +111,11 @@ testthat::test_that("AET04 variant 1 is produced correctly", { ) testthat::expect_identical( - to_string_matrix(pag_result[[3]])[4, 1], + to_string_matrix(pag_result[[3]], with_spaces = FALSE)[4, 1], "cl A.1" ) testthat::expect_identical( - to_string_matrix(pag_result[[1]])[5:6, 1], + trimws(to_string_matrix(pag_result[[1]], with_spaces = FALSE)[5:6, 1]), c("- Any Grade -", "Grade 1-2") ) }) @@ -193,11 +193,11 @@ testthat::test_that("AET04 variant 2 is produced correctly (Fill in of Treatment ) testthat::expect_identical( - to_string_matrix(pag_result[[3]])[4, 1], + to_string_matrix(pag_result[[3]], with_spaces = FALSE)[4, 1], "cl A.1" ) testthat::expect_identical( - to_string_matrix(pag_result[[1]])[5:6, 2], + to_string_matrix(pag_result[[1]], with_spaces = FALSE)[5:6, 2], c("100 (74.6%)", "10 (7.5%)") ) }) @@ -272,11 +272,11 @@ testthat::test_that("AET04 variant 3 is produced correctly (Fill in of Grades)", ) testthat::expect_identical( - to_string_matrix(pag_result[[3]])[4, 1], + to_string_matrix(pag_result[[3]], with_spaces = FALSE)[4, 1], "cl A.1" ) testthat::expect_identical( - to_string_matrix(pag_result[[1]])[5:6, 2], + to_string_matrix(pag_result[[1]], with_spaces = FALSE)[5:6, 2], c("100 (74.6%)", "10 (7.5%)") ) })