I am rendering an html document in Quarto (engine: knitr). I have added some trailing whitespaces in a kableExtra
table using " "
. However, as soon as I add pack_rows()
to the mix, " "
is rendered as text in the table. Any idea why this is happening and how I can fix it? Using escape = FALSE
within kable()
does not help.
This works as intended:
library(tidyverse)library(kableExtra)set.seed(404)mtcars_tbl <- mtcars %>% mutate( p = round(runif(nrow(.), 0, .1), 2), p = case_when( p < .05 ~ paste0(p, "*"), TRUE ~ paste0(p, " ") ) ) %>% select(mpg, hp, p)mtcars_tbl %>% head() %>% kable(align = "lrrr")
This does not:
mtcars_tbl %>% head() %>% kable(align = "lrrr") %>% pack_rows(index = c("group 1" = 3, "group 2" = 3))
Thanks in advance for any tips!