Is there an issue in kableExtra between add_header_above & scroll_box?

I am trying to format a pretty long table in a Rmarkdown that is getting turned into an html nicely. I'd like to add extra headers to make the layout easy to understand. Is there an issue in kableExtra between add_header_above & scroll_box (I'm mostly speculating on that, because of a vaguely similar issue the solution of which I could not transfer)?

Strangely, this looks just fine when I run the code-chunk within RStudio, but does not work in the resulting html.

This is with tidyverse 1.1.0 and kableExtra 1.2.1 and R 3.6.1 under Windows 10.

Any ideas what I'm messing up here or whether this is an actual bug I should post an issue for re:kableExtra?

title: "Example"
author: "Tester"
date: "1/27/2020"
output: html_document
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
tibble(Feature = rep("Example", 100),
       Frequncy2=1:100,) %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "condensed")) %>%
  add_header_above(header=c(" ", "xgboost model #1"=3, "xgboost model #2"=3)) %>%
  scroll_box(height = "33%", width = "100%")

PS: Apologies, I am failing to properly get my Rmarkdown to display, imagine that the proper things around the code bits are there.

Try using pixels for height:
height = "330px"
Apparently, when using percentage with one of the arguments (width or height) another argument must be expressed in pixels.
It seems to be default behavior for knitr::kable and kableExtra.

1 Like

Thank you very much, that actually did completely solve the problem!

Being able to specify in terms of % would be even nicer, but this certainly does the job for the particular use I have.

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