madness
madness

Reputation: 381

kableExtra: set table width on ioslides_presentation

I am using kableExtra on a ioslides_presentation R markdown file. The table however does not fit the width of the slide:

enter image description here

I am using the following code to generate the table:

library(kable)
library(kableExtra)
data %>% 
kable() %>% 
kable_styling(c("striped", "hover", "condensed", "responsive"),full_width = FALSE) 

I've also tried the argument full_width = TRUE, but was not successful.

How can I force this to happen automatically?

Upvotes: 2

Views: 641

Answers (1)

madness
madness

Reputation: 381

It turns out that it is possible to add a scroll bar to the table. This can be done using the scroll_box function as follows:

library(kable)
library(kableExtra)
data %>% 
kable() %>% 
kable_styling(c("striped", "hover", "condensed", "responsive")) %>%
scroll_box(width = "100%")

Upvotes: 2

Related Questions