Skip to content

Commit

Permalink
Simplify count_occurrences indent mods (#73)
Browse files Browse the repository at this point in the history
Closes #72
  • Loading branch information
edelarua authored Oct 31, 2023
1 parent e5cc6d3 commit f030089
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
44 changes: 22 additions & 22 deletions tests/testthat/_snaps/table_ratet01.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
Code
res
Output
B: Placebo A: Drug X C: Combination
(N=134) (N=134) (N=132)
———————————————————————————————————————————————————————————————————————————————————————————————————
Number of exacerbations per patient
0 10 (7.46%) 6 (4.48%) 11 (8.33%)
1 25 (18.66%) 21 (15.67%) 14 (10.61%)
2 38 (28.36%) 41 (30.60%) 33 (25.00%)
3 22 (16.42%) 26 (19.40%) 21 (15.91%)
4 13 (9.70%) 18 (13.43%) 30 (22.73%)
5 11 (8.21%) 10 (7.46%) 12 (9.09%)
6 10 (7.46%) 7 (5.22%) 7 (5.30%)
7 3 (2.24%) 4 (2.99%) 3 (2.27%)
8 1 (0.75%) 1 (0.75%) 1 (0.76%)
9 1 (0.75%) 0 (0.00%) 0 (0.00%)
Unadjusted exacerbation rate (per year)
Rate 7.2364 8.2148 9.8131
Adjusted (QP) exacerbation rate (per year)
Rate 2.4550 2.8514 3.4304
Rate CI (1.6194, 3.7219) (1.8974, 4.2850) (2.2946, 5.1284)
Rate Ratio 1.1615 1.3973
Rate Ratio CI (0.6462, 2.0877) (0.7789, 2.5067)
p value 0.6169 0.2619
B: Placebo A: Drug X C: Combination
(N=134) (N=134) (N=132)
——————————————————————————————————————————————————————————————————————————————————————————————————————
Number of exacerbations per patient
0 10 (7.46%) 6 (4.48%) 11 (8.33%)
1 25 (18.66%) 21 (15.67%) 14 (10.61%)
2 38 (28.36%) 41 (30.60%) 33 (25.00%)
3 22 (16.42%) 26 (19.40%) 21 (15.91%)
4 13 (9.70%) 18 (13.43%) 30 (22.73%)
5 11 (8.21%) 10 (7.46%) 12 (9.09%)
6 10 (7.46%) 7 (5.22%) 7 (5.30%)
7 3 (2.24%) 4 (2.99%) 3 (2.27%)
8 1 (0.75%) 1 (0.75%) 1 (0.76%)
9 1 (0.75%) 0 (0.00%) 0 (0.00%)
Unadjusted exacerbation rate (per year)
Rate 7.2364 8.2148 9.8131
Adjusted (QP) exacerbation rate (per year)
Rate 7.1215 8.2714 9.9508
Rate CI (4.6899, 10.8140) (5.5080, 12.4212) (6.6579, 14.8723)
Rate Ratio 1.1615 1.3973
Rate Ratio CI (0.6462, 2.0877) (0.7789, 2.5067)
p value 0.6169 0.2619

16 changes: 8 additions & 8 deletions tests/testthat/test-table_aet02.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ testthat::test_that("AET02 variant 3 is produced correctly", {
nonunique = "Total number of events"
)
) %>%
count_occurrences(vars = "AEDECOD", .indent_mods = c(count_fraction = -1L)) %>%
count_occurrences(vars = "AEDECOD", .indent_mods = -1L) %>%
append_varlabels(adae, c("AEDECOD"), indent = 2L)

result <- build_table(lyt, df = adae, alt_counts_df = adsl) %>%
Expand Down Expand Up @@ -246,7 +246,7 @@ testthat::test_that("AET02 variant 5 is produced correctly", {
nonunique = "Total number of events"
)
) %>%
count_occurrences(vars = "AEDECOD", .indent_mods = c(count_fraction = -1L)) %>%
count_occurrences(vars = "AEDECOD", .indent_mods = -1L) %>%
append_varlabels(adae, "AEDECOD", indent = 1L)

result <- build_table(lyt, df = adae_5, alt_counts_df = adsl) %>%
Expand Down Expand Up @@ -283,7 +283,7 @@ testthat::test_that("AET02 variant 6 is produced correctly", {
) %>%
count_occurrences(
vars = "AEDECOD",
.indent_mods = c(count_fraction = 1L)
.indent_mods = 1L
) %>%
append_varlabels(adae, "AEDECOD", indent = 1L)

Expand Down Expand Up @@ -393,7 +393,7 @@ testthat::test_that("AET02 variant 8 is produced correctly", {
) %>%
count_occurrences(
vars = "AEDECOD",
.indent_mods = c(count_fraction = 1L)
.indent_mods = 1L
) %>%
append_varlabels(adae, "AEDECOD", indent = 1L)

Expand Down Expand Up @@ -440,7 +440,7 @@ testthat::test_that("AET02 variant 9 is produced correctly", {
) %>%
count_occurrences(
vars = "AEDECOD",
.indent_mods = c(count_fraction = 1L)
.indent_mods = 1L
) %>%
append_varlabels(adae, "AEDECOD", indent = 1L)

Expand Down Expand Up @@ -487,7 +487,7 @@ testthat::test_that("AET02 variant 10 is produced correctly", {
) %>%
count_occurrences(
vars = "AEDECOD",
.indent_mods = c(count_fraction = 1L)
.indent_mods = 1L
) %>%
append_varlabels(adae, "AEDECOD", indent = 1L)

Expand Down Expand Up @@ -534,7 +534,7 @@ testthat::test_that("AET02 variant 11 is produced correctly", {
) %>%
count_occurrences(
vars = "AEDECOD",
.indent_mods = c(count_fraction = 1L)
.indent_mods = 1L
) %>%
append_varlabels(adae, "AEDECOD", indent = 1L)

Expand Down Expand Up @@ -581,7 +581,7 @@ testthat::test_that("AET02 variant 12 is produced correctly", {
) %>%
count_occurrences(
vars = "AEDECOD",
.indent_mods = c(count_fraction = 1L)
.indent_mods = 1L
) %>%
append_varlabels(adae, "AEDECOD", indent = 1L)

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-table_aet09.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ testthat::test_that("AET09 variant 2 is produced correctly, AE related to study
nonunique = "Total number of events related to study drug"
)
) %>%
count_occurrences(vars = "AEDECOD", .indent_mods = c(count_fraction = -1L))
count_occurrences(vars = "AEDECOD", .indent_mods = -1L)

result <- build_table(lyt, adae_r, alt_counts_df = adsl) %>%
prune_table()
Expand Down

0 comments on commit f030089

Please sign in to comment.