The vertical scrollbar generated with kableExtra
works in RStudio but doesn't work in the knitted html_document.
Take the following Rmd
file
---
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)
library(dplyr)
library(kableExtra)
```
```{r}
iris %>%
kable %>%
kable_styling("striped", full_width = F)
```
When running the chunk in RStudio, I see a vertical scrollbar
But after knitting, the vertical scrollbar is gone and the whole data.frame is printed
How can I get the vertical scrollbar to display in the knitted HTML the same as it was in RStudio?
Have a look at the function scroll_box()
from the package kableExtra
.
```{r}
iris %>%
kable %>%
kable_styling("striped", full_width = F) %>%
scroll_box(width = "500px", height = "200px")
```
To specify the size of the box, see the arguments in the documentation