Column contents can be removed from an rtable during post-processing using the workaround demonstrated in the following example.
For a more precise solution, instead of attaching your table code please provide a fully reproducible example (with output). This can be generated in R using the reprex::reprex()
function.
This method of creating empty columns is generally not recommended - it is advised that rtables users create a custom analysis function that does exactly what is needed instead of removing values during post-processing.
library(rtables)
lyt <- basic_table() %>%
split_cols_by("ARM") %>%
analyze("AGE", afun = list_wrap_x(summary), format = "xx.xx")
tbl <- build_table(lyt, DM)
tbl
#> A: Drug X B: Placebo C: Combination
#> —————————————————————————————————————————————————
#> Min. 20.00 21.00 22.00
#> 1st Qu. 29.00 29.00 30.00
#> Median 33.00 32.00 33.00
#> Mean 34.91 33.02 34.57
#> 3rd Qu. 39.00 37.00 38.00
#> Max. 60.00 55.00 53.00
# empty all rows in columns 1 and 3
for (col in c(1, 3)) {
for (row in seq_len(nrow(tbl))) {
tbl[row, col] <- rcell("", format = "xx")
}
}
tbl
#> A: Drug X B: Placebo C: Combination
#> —————————————————————————————————————————————————
#> Min. 21.00
#> 1st Qu. 29.00
#> Median 32.00
#> Mean 33.02
#> 3rd Qu. 37.00
#> Max. 55.00