Strange HTML output from kableExtra package in RStudio

Viewed 523

I've having some issues with the kableExtra output in RStudio. I'm trying to create a formatted table in an R markdown file once I hit the 'knit' button.

The code is:

kable(temp_table, "html") %>%
  add_header_above(c(" " = 1, "Group 1" = 2, "Group 2" = 2, "Group 3" = 2)) %>%
  kable_styling(bootstrap_options = c("striped", "condensed", "hover", "responsive"), font_size = 11, full_width = FALSE, position = "left") %>%
  column_spec(1, bold = T) 

It should create a simple table with a header row that I added. But not only does that not show up, but neither do the variable row names. And what precedes the table is a bunch of HTML code that looks like it wasn't rendered.

enter image description here

Some version history: kableExtra - 0.6.1
knitr - 1.17
rmarkdown - 1.7
R - 3.3.3
RStudio - 1.1.258

Would appreciate any help with this!

---- UPDATE ----
Below is a simple reproducible example that gives me the same kind of output.

---
title: "Iris Example"
output_file: "iris2.html"
---

## Iris Data
``` {r iris, echo = FALSE, warning = FALSE}

library(data.table)
library(knitr)
library(kableExtra)

iris <- data.table(iris)
iris <- iris[, .(
            sep_len = mean(Sepal.Length)
            , sep_wid = mean(Sepal.Width)
            , pet_len = mean(Petal.Length)
            , pet_wid = mean(Petal.Width)
            ), by = .(Species)]

kable(iris, "html") %>%
add_header_above(c(" " = 1, "Group 1" = 2, "Group 2" = 2)) %>%
kable_styling(bootstrap_options = c("striped", "condensed", "hover", "responsive"), font_size = 10, full_width = FALSE, position = "left") %>%
column_spec(1, bold = T) 
```
1 Answers

I've reproduced this output only on an OS X. Installing the latest version of kableExtra (0.7.0.9000) with devtools::install_github("haozhu233/kableExtra") solved the problem for me.

Related