kpr62
kpr62

Reputation: 561

group_rows() function in kableExtra package not grouping rows

I am trying to output a table in rmarkdown using the kable() as a part of the knitr package. Below is one table that shows what I am trying to output with a built in data set. The other is a subset of my data set. When using my data set the output is not lining up and the code is basically the same. I feel like I a missing something basic? Please let me know! My code is below, and a picture of the output is below that.

```{r, results="asis"}
Table = kable(mtcars[1:10, 1:6], caption = "GOOD TABLE", booktabs = T, format="latex")
Table = kable_styling(Table) 
Table = group_rows(Table, "Group 1", 2, 4) 
group_rows(Table, "Group 2", 5, 6)
```

```{r, results="asis"}
Table = data.frame(MYDATA)
Table = kable(Table, caption = "BAD TABLE", booktabs = T, format="latex")
Table = kable_styling(Table) 
Table = group_rows(Table, "Group 1", 2, 4) 
group_rows(Table, "Group 2", 5, 6)
```

Output Result

Upvotes: 3

Views: 2583

Answers (1)

Hao
Hao

Reputation: 7826

Thanks for reporting!

This bug was produced by a mishandling of backslash in front of special inline symbols. It has been fixed in the current github version. Please use devtools::install_github("haozhu233/kableExtra") and install the latest version. Or you can wait for the CRAN version which will be release in about 2 weeks.

Upvotes: 2

Related Questions