Avoid overlapping columns with kable

Hello :slightly_smiling_face:

I'm developing an R Markdown script (whose output must be pdf_document) to generate a report with graphs and tables of a database data (I get this data through API calls) and I don't know how to avoid column overlapping when I get long texts.

kable(dataframe, row.names = FALSE, longtable = TRUE, align = c('l', 'c', 'c', 'c'), booktabs = T) %>%
 kable_styling(position = "left",
               latex_options = "repeat_header",
               font_size = 9) %>%
 row_spec(0, bold = T, color = "white", background = "#00B2A9") %>%
 column_spec(1, width = "3.5cm") %>%
 column_spec(2, width = "5cm") %>%
 column_spec(3, width = "3cm") %>%
 column_spec(4, width = "7cm")

For this table, I could increase the width of the second column_spec, but I have the same column in many tables and some of them have 9-10 columns, so it's not a good solution because the width of the table would exceed the right margin of the document.

Thanks for the help in advance and sorry if this question or similar has already been resolved.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.