diff --git a/NEWS.md b/NEWS.md index 9eab08b2f8..a5c6d7c9ad 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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`. diff --git a/R/tm_t_events.R b/R/tm_t_events.R index e2436354ff..e89ace16a8 100644 --- a/R/tm_t_events.R +++ b/R/tm_t_events.R @@ -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), diff --git a/tests/testthat/_snaps/tm_t_events.md b/tests/testthat/_snaps/tm_t_events.md index ae094017c6..403dbf5b19 100644 --- a/tests/testthat/_snaps/tm_t_events.md +++ b/tests/testthat/_snaps/tm_t_events.md @@ -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) @@ -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) @@ -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) @@ -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) @@ -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)