I recently updated my R and Rstudio, and now kbl()
doesn't seem to recognizing styling from qwraps2::summary_statistics
, where the section header from qwraps2::summary_statistic
is being recognized as an extra row. 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))kbl(tbl, col.names = colnames(tbl), escape = F) %>% kable_styling() %>% pack_rows('Sepal Length', 1, 2) %>% pack_rows('Sepal Width', 3, 4)