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

Solution for maintaining indent after pruning #791

Merged
merged 5 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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