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

update scda.test snaps allowing key column to change #67

Merged
merged 10 commits into from
Oct 31, 2023
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ 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.3.9002),
R (>= 3.6),
rlistings (>= 0.2.5.9002),
rtables (>= 0.6.4.9003),
tern (>= 0.9.1.9005)
formatters (>= 0.5.4.9002),
R (>= 4.2),
rlistings (>= 0.2.6.9005),
rtables (>= 0.6.5.9004),
tern (>= 0.9.2.9001)
Imports:
scda (>= 0.1.6.9012),
scda.2022 (>= 0.1.5.9002)
Expand Down
37 changes: 37 additions & 0 deletions tests/testthat/_snaps/table_ttet01.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,43 @@
95% CI (-11.86, 11.86) (-20.95, 2.97)
p-value (Z-test) 1.0000 0.1406

# TTET01 default variant with Placebo arm

Code
res
Output
A: Drug X C: Combination B: Placebo
(N=134) (N=132) (N=134)
———————————————————————————————————————————————————————————————————————————————————
Patients with event (%) 58 (43.3%) 69 (52.3%) 58 (43.3%)
Earliest contributing event
Death 58 69 58
Patients without event (%) 76 (56.7%) 63 (47.7%) 76 (56.7%)
Time to Event (Months)
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 (censored) 9.9 to 16.4 9.9 to 16.3 9.9 to 16.3
Range (event) 0.5 to 9.6 0.5 to 9.8 0.9 to 9.6
Unstratified Analysis
p-value (log-rank) 0.9998 0.1480
Hazard Ratio 1.00 1.29
95% CI (0.69, 1.44) (0.91, 1.83)
6 Months
Patients remaining at risk 97 90 97
Event Free Rate (%) 72.39 68.18 72.39
95% CI (64.82, 79.96) (60.24, 76.13) (64.82, 79.96)
Difference in Event Free Rate 0.00 -4.21
95% CI (-10.71, 10.71) (-15.18, 6.77)
p-value (Z-test) 1.0000 0.4525
12 Months
Patients remaining at risk 49 37 48
Event Free Rate (%) 56.72 47.73 56.72
95% CI (48.33, 65.11) (39.21, 56.25) (48.33, 65.11)
Difference in Event Free Rate 0.00 -8.99
95% CI (-11.86, 11.86) (-20.95, 2.97)
p-value (Z-test) 1.0000 0.1406

# TTET01 variant 2: selecting sections to display

Code
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-table_aovt01.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ testthat::test_that("AOVT01 variant with single endpoint is produced correctly",
dplyr::mutate(CHG = ifelse(BMEASIFL == "Y", CHG, NA)) # only analyze evaluable population

result <- basic_table() %>%
split_cols_by("ARMCD", ref_group = "ARM A") %>%
split_cols_by("ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
add_colcounts() %>%
summarize_ancova(
vars = "CHG",
Expand All @@ -38,7 +38,7 @@ testthat::test_that("AOVT01 variant with multiple endpoints is produced correctl
n_per_arm <- table(adsl$ARM)

result <- basic_table() %>%
split_cols_by("ARMCD", ref_group = "ARM A") %>%
split_cols_by("ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
add_colcounts() %>%
split_rows_by("PARAMCD") %>%
summarize_ancova(
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-table_aovt02.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ adqs_single <- adqs %>%

testthat::test_that("AOVT02 is produced correctly", {
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ARMCD", ref_group = "ARM A") %>%
split_cols_by("ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
append_varlabels(adqs_single, "PARAM") %>%
summarize_ancova(
vars = "CHG",
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-table_aovt03.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ adqs_in <- adqs %>%

testthat::test_that("AOVT03 is produced correctly", {
result <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ARMCD", ref_group = "ARM A") %>%
split_cols_by("ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
split_rows_by("PARAM", split_fun = drop_split_levels) %>%
summarize_ancova(
vars = "CHG",
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-table_cmht01.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ testthat::test_that("CMHT01 variant 1 is produced correctly", {
mutate(strata = interaction(STRATA1, STRATA2, drop = TRUE))

lyt_01 <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ARM", ref_group = "A: Drug X") %>%
split_cols_by(var = "ARM", ref_group = "A: Drug X", split_fun = ref_group_position("first")) %>%
estimate_proportion(vars = "is_rsp", table_names = "est_prop") %>%
estimate_proportion_diff(
var_labels = "Unstratified Analysis",
Expand Down Expand Up @@ -68,7 +68,7 @@ testthat::test_that("CMHT01 variant 2 is produced correctly", {
split_fun <- drop_split_levels

lyt_02 <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ARM", ref_group = "A: Drug X") %>%
split_cols_by(var = "ARM", ref_group = "A: Drug X", split_fun = ref_group_position("first")) %>%
split_rows_by(
var = "PARAM",
split_fun = split_fun,
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-table_dort01.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ testthat::test_that("DORT01 variant 1 is produced correctly", {
adtte <- adtte_local

result <- basic_table() %>%
split_cols_by(var = "ARM", ref_group = "A: Drug X") %>%
split_cols_by(var = "ARM", ref_group = "A: Drug X", split_fun = ref_group_position("first")) %>%
add_colcounts() %>%
count_values(
vars = "USUBJID",
Expand Down Expand Up @@ -82,7 +82,7 @@ testthat::test_that("DORT01 variant 2 (selecting sectons) is produced correctly"
adtte <- adtte_local

result <- basic_table() %>%
split_cols_by(var = "ARM", ref_group = "A: Drug X") %>%
split_cols_by(var = "ARM", ref_group = "A: Drug X", split_fun = ref_group_position("first")) %>%
add_colcounts() %>%
count_values(
vars = "USUBJID",
Expand Down Expand Up @@ -138,7 +138,7 @@ testthat::test_that("DORT01 variant 3 (modifying conftype and alpha level) is pr
adtte <- adtte_local

result <- basic_table() %>%
split_cols_by(var = "ARM", ref_group = "A: Drug X") %>%
split_cols_by(var = "ARM", ref_group = "A: Drug X", split_fun = ref_group_position("first")) %>%
add_colcounts() %>%
count_values(
vars = "USUBJID",
Expand Down Expand Up @@ -194,7 +194,7 @@ testthat::test_that("DORT01 variant 4 (modifying time point for the “xx durati
adtte <- adtte_local

result <- basic_table() %>%
split_cols_by(var = "ARM", ref_group = "A: Drug X") %>%
split_cols_by(var = "ARM", ref_group = "A: Drug X", split_fun = ref_group_position("first")) %>%
add_colcounts() %>%
count_values(
vars = "USUBJID",
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-table_lbt11.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ anl <- adsaftte %>%

testthat::test_that("LBT11 variant 1 works as expected", {
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
count_occurrences(vars = "event_grp") %>%
surv_time(
vars = "AVAL",
Expand All @@ -62,7 +62,7 @@ testthat::test_that("LBT11 variant 1 works as expected", {

testthat::test_that("LBT11 variant 2 works as expected", {
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
count_occurrences(vars = "event_grp") %>%
surv_time(
vars = "AVAL",
Expand All @@ -81,7 +81,7 @@ testthat::test_that("LBT11 variant 3 works as expected", {
strata <- c("RACE", "SEX")

lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
count_occurrences(vars = "event_grp") %>%
surv_time(
vars = "AVAL",
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-table_lbt11_bl.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ anl <- adsaftte %>%

testthat::test_that("LBT11_BL variant 1 works as expected", {
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
count_occurrences(vars = "event_grp") %>%
surv_time(
vars = "AVAL",
Expand All @@ -62,7 +62,7 @@ testthat::test_that("LBT11_BL variant 1 works as expected", {

testthat::test_that("LBT11_BL variant 2 works as expected", {
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
count_occurrences(vars = "event_grp") %>%
surv_time(
vars = "AVAL",
Expand All @@ -81,7 +81,7 @@ testthat::test_that("LBT11_BL variant 3 works as expected", {
strata <- c("RACE", "SEX")

lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
count_occurrences(vars = "event_grp") %>%
surv_time(
vars = "AVAL",
Expand Down
5 changes: 4 additions & 1 deletion tests/testthat/test-table_ratet01.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ anl <- df_explicit_na(anl)

testthat::test_that("RATET01 is produced correctly", {
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ARM", ref_group = "B: Placebo") %>%
split_cols_by("ARM",
ref_group = "B: Placebo",
split_fun = ref_group_position("first")
) %>%
analyze_vars(
"AVAL_f",
var_labels = "Number of exacerbations per patient",
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-table_rmpt06.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ testthat::test_that("RMPT06 variant 2 is produced correctly", {

testthat::test_that("RMPT06 variant 3 is produced correctly", {
lyt_adsl <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ACTARM", ref_group = "A: Drug X") %>%
split_cols_by("ACTARM", ref_group = "A: Drug X", split_fun = ref_group_position("first")) %>%
estimate_proportion(
vars = "AEFL",
method = "clopper-pearson",
Expand Down Expand Up @@ -213,7 +213,7 @@ testthat::test_that("RMPT06 variant 3 is produced correctly", {

testthat::test_that("RMPT06 variant 4 is produced correctly", {
lyt_adsl <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ACTARM", ref_group = "A: Drug X") %>%
split_cols_by("ACTARM", ref_group = "A: Drug X", split_fun = ref_group_position("first")) %>%
estimate_proportion(
vars = "AEFL",
conf_level = 0.90,
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-table_rspt01.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ adrs <- adrs %>%

testthat::test_that("RSPT01: 1. Best Overall Response", {
l <- basic_table() %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
add_colcounts() %>%
estimate_proportion(
vars = "is_rsp",
Expand Down Expand Up @@ -48,7 +48,7 @@ testthat::test_that("RSPT01: 1. Best Overall Response", {

testthat::test_that("RSPT01: 2. Best Overall Response (selecting sections to display)", {
l <- basic_table() %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
add_colcounts() %>%
estimate_proportion(
vars = "is_rsp",
Expand Down Expand Up @@ -77,7 +77,7 @@ testthat::test_that("RSPT01: 3. Best Overall Response (modifying settings)", {
conf_level <- 0.90
method_prop <- "clopper-pearson"
l <- basic_table() %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
add_colcounts() %>%
estimate_proportion(
vars = "is_rsp",
Expand Down Expand Up @@ -118,7 +118,7 @@ testthat::test_that("RSPT01: 3. Best Overall Response (modifying settings)", {

testthat::test_that("RSPT01: 4. Best Overall Response (with stratified analysis)", {
l <- basic_table() %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
add_colcounts() %>%
estimate_proportion(
vars = "is_rsp",
Expand Down Expand Up @@ -168,7 +168,7 @@ testthat::test_that("RSPT01: 4. Best Overall Response (with stratified analysis)

testthat::test_that("RSPT01: 5. Best Overall Response (modifying the definition of overall response)", {
l <- basic_table() %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
add_colcounts() %>%
estimate_proportion(
vars = "is_rsp",
Expand Down Expand Up @@ -219,7 +219,7 @@ testthat::test_that("RSPT01: 6. Best Overall Response (define new sections to di
)

l <- basic_table() %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A", split_fun = ref_group_position("first")) %>%
add_colcounts() %>%
estimate_proportion(
vars = "is_rsp",
Expand Down
Loading