kable, collapse_rows and booktabs: no alignement to the top

匆匆过客 提交于 2021-02-11 17:01:26

问题


I am trying to print a data.frame in a pdf using kable and collapse_rows functions. And it did not manage to make it works. Please try the following reprex:

---
title: "Example"
output:
  bookdown::pdf_document2
---

```{r bandIdentif, echo=F}

 library(dplyr);library(kableExtra)

 dt <- data.frame(A = c(rep("a", 2), rep("b", 3)),
                  B = c(paste("answer", 1:5)))

 kable(dt, "latex") %>%
   collapse_rows(columns = 1, valign = "top")

```

I have updated all the packages (MaxTex and R) and Rstudio. However, the pdf output exhibit a strange behavior of vertical alignment:

I looked during hours on the web but i cannot manage to find a solution. Please help :)

来源:https://stackoverflow.com/questions/62419547/kable-collapse-rows-and-booktabs-no-alignement-to-the-top

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!