Wrap long table headers R shiny using

knitr

#1

I have a table with long header names. How can I auto wrap them for a table in R Shiny. Below is what I am using so far :

  output$tablep1 <-
    function() {
      prev_prod_use() %>%
        knitr::kable("html") %>%
        kable_styling(
        ) %>%
        scroll_box(width = "100%", height = "300px")
    }

#2

It's manual, but you can use <br/> for new lines.


#3

I’ve used stringr:str_wrap for this before in conjunction with kable, though not in a shiny context.