If I need a bit of control about table width, due to automatic multirow not always working great, I can display wider than 100% table with a scroll_box. I can manually control the table width by setting table.attr = 'style="width: 200%"', i.e. the table being twice as wide as the document, meaning I can see half of the table width in the scroll box.
However, when I want to use some kable_styling, this breaks down. Some automatic width scaling is used, that makes nonsense multirow table that looks ugly.
I want to used the striped styling but keep my width setting.
Even the "full_width = TRUE" argument is not respected and the table is narrowed by the kable_styling.
# Generate example data
dt <- data.table(
Name = c('Adam', 'Bronn', 'Caligula'),
Description = c(
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit.",
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit.",
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit."
),
Age = c(25, 30, 35),
Salary = c(50000, 60000, 70000)
)
for(x in LETTERS){
dt[[x]] <- rnorm(3) %>% round(3)
}
# Correctly display wide table with scroll_box
kable(dt, table.attr = 'style="width: 200%"') %>%
scroll_box(width = '100%')
# Break the setting with kable_styling
kable(dt, table.attr = 'style="width: 200%"') %>%
kable_styling('striped', full_width = TRUE) %>%
scroll_box(width = '100%')