Closed pzhang-cims closed 1 month ago
Sry just happen to find out that we can implement like below with child_labels='hidden'
lyt <- basic_table() %>%
split_cols_by(var= 'ARM')%>%
###to specify if total colum is needed, label and be set
add_overall_col('Total')%>%
###add colcounts for all.
add_colcounts()%>%
split_rows_by(
"AESOC",
child_labels = "hidden"
) %>%
### you just need a variable here,
count_occurrences(
vars = c("AESOC"),
.indent_mods =0
) %>%
count_occurrences(
vars = c("AEDECOD"),
.indent_mods =1
)
###for alt_counts_df, make sure they have the same colum variable name
build_table(lyt,random.cdisc.data::cadae,alt_counts_df = random.cdisc.data::cadsl)
Feature description
Hi there,
Thanks for the effort on {tern} package development! I would like to check with you, if there a way to generate an occurrence table with the shell like below? The occurrence (take AE table as example) and percentage are shown as the same row as the SOC level.
I know that there is a way to generate the number by
split_rows_by()
and thensummarize_num_patients()
. However, this way only generate the n() into another line.Also, i notice there is a function called summarize_row_groups() to add split_rows_by, however, this can only count non-unique number, instead of unique numbers. So even with customize cfun, this cannot achieve the goal.
Can we have a way to generate the results like above in screenshot?
Thanks in advance.
Best,
Code of Conduct
Contribution Guidelines
Security Policy