Closed jagadishkatam closed 11 months ago
You can override numeric display formats using set_format_strings()
. Here's how you can correct this specific case:
t <- Tplyr::tplyr_table(adae, TRTA) %>%
set_pop_data(adsl) %>%
set_pop_treat_var(TRTA) %>%
set_pop_where(TRUE) %>%
Tplyr::add_layer(
group_count(all, by='Subjects with any Adverse Events') %>%
set_format_strings(f_str("xx (xxx.x%)", distinct_n, distinct_pct))
) %>%
set_distinct_by(USUBJID) %>%
Tplyr::add_layer(
group_count(vars(AEBODSYS,AEDECOD)) %>%
set_format_strings(f_str("xx (xxx.x%)", distinct_n, distinct_pct))
) %>%
set_distinct_by(USUBJID)
dt <- t %>% Tplyr::build()
Thank you @mstackhouse , appreciate your help.
Hi @mstackhouse, Appreciate your prompt response, it worked for me as per your suggestion.
However i am struck with another issue, the 'subjects with any adverse events' does not align with adverse event counts and percentage. I am not sure of the reason.
I am using the same code as given earlier except for below update
tbl <- create_table(dt) %>% define(row_label1, visible = FALSE) %>% define(row_label2, label = "", indent = .25) %>% define(var1_Placebo, label = "Placebo", align = "left", n = 86) %>% define(var1_Xanomeline_High_Dose, label = "Xanomeline High Dose", align = "left", n = 84) %>% define(var1_Xanomeline_Low_Dose, label = "Xanomeline Low Dose", align = "left", n = 84) %>% define(ord_layer_index, visible = FALSE) %>% define(ord_layer_1, visible = FALSE, blank_after = TRUE) %>% define(ord_layer_2, visible = FALSE)
Originally posted by @jagadishkatam in https://github.com/atorus-research/Tplyr/issues/135#issuecomment-1730113107