我使用Rmarkdown生成一个HTML,其中两个kables使用kable::kables并排放置。但是,在并排的kables上方有一条额外的线,我想移除。我读过“kableExtra文档”,但似乎他们没有报道这个问题。
我想移除的水平线用下面的红色箭头表示。

以下是我的Rmarkdown代码供您参考:
---
title: "Untitled"
author: "benson23"
output:
html_document:
theme: default
toc: yes
toc_depth: 4
toc_float: true
code_folding: hide
---
```{r setup, include=FALSE}knitr::opts_chunk$set(echo =真)
图书馆(Tidyverse)
图书馆(Rmarkdown)
图书馆(KableExtra)
图书馆(针织品)
## Help with Kable
As you can see, there's an extra line above the aligned tables, which I would like to remove.
```{r kable_extra_line}df1 <- Ti球(Dummy= c(90748,91006,90748,91006),
A = c(0, 6, 1, 110), B = c(8, 0, 339, 0), C = c(6, 7, 909, 309), D = c(0, 0, 0, 0))df2 <- Ti球(Dummy= c(90748,91006,90748,91006),
A = c(0, 901, 0, 50), B = c(0, 1, 122, 0), C = c(1847, 1, 754, 625), D = c(1, 0, 0, 0))表(表)
kable(df1) %>%
kable_styling(bootstrap_options = c("striped", "bordered"), full_width = F) %>%row_spec(0, bold = T) %>%pack_rows("Pack some rows here", 1, 2, label_row_css = "background-color: #666; color: #fff;") %>%pack_rows("Pack some rows here", 3, 4, label_row_css = "background-color: #666; color: #fff;"),kable(df2) %>%
kable_styling(bootstrap_options = c("striped", "bordered"), full_width = F) %>%row_spec(0, bold = T) %>%pack_rows("Pack some rows here", 1, 2, label_row_css = "background-color: #666; color: #fff;") %>%pack_rows("Pack some rows here", 3, 4, label_row_css = "background-color: #666; color: #fff;")) %>%
kable_styling()
如果你知道如何移除这条线,那就太好了!
发布于 2022-02-09 12:49:24
您可以添加css .kable_wrapper { border: hidden;}。
---
title: "Untitled"
author: "benson23"
output:
html_document:
theme: default
toc: yes
toc_depth: 4
toc_float: true
code_folding: hide
---
```{r setup, include=FALSE}knitr::opts_chunk$set(echo =真)
图书馆(Tidyverse)
图书馆(Rmarkdown)
图书馆(KableExtra)
图书馆(针织品)
<style>
.kable_wrapper {
border: hidden;
}
</style>
## Help with Kable
As you can see, there's an extra line above the aligned tables, which I would like to remove.
```{r kable_extra_line}df1 <- tibble(Dummy = c(90748, 91006, 90748, 91006), A = c(0, 6, 1, 110), B = c(8, 0, 339, 0), C = c(6, 7, 909, 309), D = c(0, 0, 0, 0))df2 <- tibble(Dummy = c(90748, 91006, 90748, 91006), A = c(0, 901, 0, 50), B = c(0, 1, 122, 0), C = c(1847, 1, 754, 625), D = c(1, 0, 0, 0))kables(list( kable(df1) %>% kable_styling(bootstrap_options = c("striped", "bordered"), full_width = F) %>% row_spec(0, bold = T) %>% pack_rows("Pack some rows here", 1, 2, label_row_css = "background-color: #666; color: #fff;") %>% pack_rows("Pack some rows here", 3, 4, label_row_css = "background-color: #666; color: #fff;"), kable(df2) %>% kable_styling(bootstrap_options = c("striped", "bordered"), full_width = F) %>% row_spec(0, bold = T) %>% pack_rows("Pack some rows here", 1, 2, label_row_css = "background-color: #666; color: #fff;") %>% pack_rows("Pack some rows here", 3, 4, label_row_css = "background-color: #666; color: #fff;"))) %>% kable_styling() https://stackoverflow.com/questions/71049830
复制相似问题