Eric Green
Eric Green

Reputation: 7735

first column outside of kable table with kable_styling()

Why does the first column appear outside of the table in html tags when using kable_styling() in this pipe?

---
title: "Untitled"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

```{r results='asis'}
  x <- data.frame(v1=c("1", "2"),
                  v2=c("3", "4"))
  library(knitr)
  library(kableExtra)

  x %>%
    kable("html") %>%
    kable_styling()
```

enter image description here

Upvotes: 4

Views: 969

Answers (2)

Hao
Hao

Reputation: 7856

This bug was caused by an incorrect handling of HTML tags on some machines (sadly we didn't find the exact reason) and has now been addressed in the development version of kableExtra. If anyone encounters this issue, please update your kableExtra to the latest CRAN/github version.

Upvotes: 4

AgnieszkaTomczyk
AgnieszkaTomczyk

Reputation: 335

You have to remove the current version of package "scales" and install "kableExtra" again.

In my case in helped, have a look at the first screen: R was not able to remove the old version of "scales" package.

Before:

enter image description here

After:

enter image description here

Upvotes: 0

Related Questions