Skip to content

Commit

Permalink
Solution for maintaining indent after pruning (#791)
Browse files Browse the repository at this point in the history
closes #790

---------

Co-authored-by: Joe Zhu <[email protected]>
Co-authored-by: Jana Stoilova <[email protected]>
  • Loading branch information
3 people authored Sep 20, 2023
1 parent 0a523d5 commit 7760c3c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Increased default width of `tm_g_forest_tte` plot to prevent overlapping text.
* Improve default annotation table sizing in `tm_g_km`.
* Refactored `tm_t_exposure` to display "total" row as last row in table instead of as a summary row. Added parameters `add_total_row` to set whether the total row should be displayed and `total_row_label` to set the total row label.
* Update `tm_t_events` to maintain indentation after pruning.

### Miscellaneous
* Updated `control_incidence_rate` parameter names in `tm_t_events_patyear` from `time_unit_input` and `time_unit_output` to `input_time_unit` and `num_pt_year`, respectively, after parameter names were changed in `tern`.
Expand Down
2 changes: 1 addition & 1 deletion R/tm_t_events.R
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ template_events <- function(dataname,
nonunique = nonunique_label
)
) %>%
count_occurrences(vars = llt, .indent_mods = -1L) %>%
count_occurrences(vars = llt, .indent_mods = c(count_fraction = 1L)) %>%
append_varlabels(dataname, llt, indent = 1L),
env = list(
dataname = as.name(dataname),
Expand Down
20 changes: 10 additions & 10 deletions tests/testthat/_snaps/tm_t_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
summarize_num_patients(var = "USUBJID", .stats = c("unique",
"nonunique"), .labels = c(unique = "Total number of patients with at least one event",
nonunique = "Overall total number of events")) %>% count_occurrences(vars = "AEDECOD",
.indent_mods = -1L) %>% append_varlabels(adae, "AEDECOD",
indent = 1L)
.indent_mods = c(count_fraction = 1L)) %>% append_varlabels(adae,
"AEDECOD", indent = 1L)
$table
result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl)
Expand Down Expand Up @@ -86,8 +86,8 @@
summarize_num_patients(var = "USUBJID", .stats = c("unique",
"nonunique"), .labels = c(unique = "Total number of patients with at least one event",
nonunique = "Overall total number of events")) %>% count_occurrences(vars = "AEDECOD",
.indent_mods = -1L) %>% append_varlabels(adae, "AEDECOD",
indent = 1L)
.indent_mods = c(count_fraction = 1L)) %>% append_varlabels(adae,
"AEDECOD", indent = 1L)
$table
result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl)
Expand Down Expand Up @@ -181,8 +181,8 @@
summarize_num_patients(var = "USUBJID", .stats = c("unique",
"nonunique"), .labels = c(unique = "Total number of patients with at least one event",
nonunique = "Overall total number of events")) %>% count_occurrences(vars = "AEDECOD",
.indent_mods = -1L) %>% append_varlabels(adae, "AEDECOD",
indent = 1L)
.indent_mods = c(count_fraction = 1L)) %>% append_varlabels(adae,
"AEDECOD", indent = 1L)
$table
result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl)
Expand Down Expand Up @@ -230,8 +230,8 @@
summarize_num_patients(var = "USUBJID", .stats = c("unique",
"nonunique"), .labels = c(unique = "Total number of patients with at least one event",
nonunique = "Overall total number of events")) %>% count_occurrences(vars = "AEDECOD",
.indent_mods = -1L) %>% append_varlabels(adae, "AEDECOD",
indent = 1L)
.indent_mods = c(count_fraction = 1L)) %>% append_varlabels(adae,
"AEDECOD", indent = 1L)
$table
result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl)
Expand Down Expand Up @@ -296,8 +296,8 @@
summarize_num_patients(var = "USUBJID", .stats = c("unique",
"nonunique"), .labels = c(unique = "Total number of patients with at least one event",
nonunique = "Overall total number of events")) %>% count_occurrences(vars = "AEDECOD",
.indent_mods = -1L) %>% append_varlabels(adae, "AEDECOD",
indent = 1L)
.indent_mods = c(count_fraction = 1L)) %>% append_varlabels(adae,
"AEDECOD", indent = 1L)
$table
result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl)
Expand Down

0 comments on commit 7760c3c

Please sign in to comment.