group_rows() function in kableExtra package not grouping rows

Viewed 2047

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

1 Answers
Related