I have a long string which I want in a table, for instance 100x the letter A (AAA...). I would like kable to split this string into multiple lines if they don't fit in the table instead of making these strings overflow such as shownhere.
I noticed kable is actually able of doing so, provided there are newlines or -
's in your string, see for instance here.
However, I would like kable to do this splitting on either selected characters or on any character, so the output result would be this, but I don't know how to achieve this. I had a look on SO and in the kableextra documentation, but no luck. Any suggestions?
Below is a chunk to play around with.
---title: 'rasstasrt'sansfont: Calibri Lightoutput: pdf_document---```{r setup, include=FALSE}library(kableExtra);library(dplyr)knitr::opts_chunk$set(cache = F)``````{r}dt <-tibble(Items =c("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaAAa", "Item 2", "Item 3"), Tmd5ext_1 =c("Lorem ipsum "), Text_2 =c("Duis pos "))kableExtra::kable(dt, "latex", booktabs = F, col.names =c("Item", "Short Title", "Veryong Title")) %>% column_spec(1:3, width = "5cm", )```