I recently updated my R and Rstudio, and now kable
doesn't seem to recognizing styling from qwraps2
. Here's a reproducible example with the output I get in Viewer.
options(qwraps2_markup = "markdown")summary_statistics <- list("Sepal Length" = list("N (%)" = ~qwraps2::n_perc0(!is.na(Sepal.Length), na_rm = TRUE),"Mean (SD)" = ~paste0(round(mean(Sepal.Length, na.rm = T), 1), ' (', round(sd(Sepal.Length, na.rm = T), 1), ')') ),"Sepal Width" = list("N (%)" = ~qwraps2::n_perc0(!is.na(Sepal.Width), na_rm = TRUE),"Mean (SD)" = ~paste0(round(mean(Sepal.Width, na.rm = T), 1), ' (', round(sd(Sepal.Width, na.rm = T), 1), ')') ) )tbl <- summary_table(iris, summary_statistics, by = 'Species')colnames(tbl) <- gsub('\\(', '\\<br\\/\\>\\(', colnames(tbl))kable(tbl, col.names = colnames(tbl), escape = F) %>% kable_styling() %>% pack_rows('Sepal Length', 1, 2) %>% pack_rows('Sepal Width', 3, 4)
Image may be NSFW.
Clik here to view.
UPDATE: Styling issue is fixed by using kbl()
. However, is there an option so that the header row for each section is not repeated from summary_statistics
and pack_rows
? Would like to keep the header rows from pack_rows instead.