remove N=xx frmo header is not working if col_counts is given:
library(rtables)
lyt3 <- basic_table(show_colcounts = FALSE) %>%
split_cols_by("ARM") %>%
analyze("AGE", afun = function(x) {
setNames(as.list(fivenum(x)), c(
"minimum", "lower-hinge", "median",
"upper-hinge", "maximum"
))
})
tbl6 <- build_table(lyt3, DM, col_counts = 1:3)
tbl6@col_info@display_columncounts <- FALSE
tbl6
then you will have this:
> tbl6
A: Drug X B: Placebo C: Combination
(N=1) (N=2) (N=3)
—————————————————————————————————————————————————————
minimum 20 21 22
lower-hinge 29 29 30
median 33 32 33
upper-hinge 39 37 38
maximum 60 55 53
yet, this is what I expected:
> tbl6
A: Drug X B: Placebo C: Combination
—————————————————————————————————————————————————————
minimum 20 21 22
lower-hinge 29 29 30
median 33 32 33
upper-hinge 39 37 38
maximum 60 55 53
Thanks for checking!!
based on above Garini's indication, please try below code, colcounts could be invisible:
leaf_paths <- col_paths(tbl6)
for (pth in leaf_paths) {
colcount_visible(tbl6, pth) <- FALSE
}
tbl6