在生成的 Rmarkdown 中并排放置 Kable 后,R 删除 header 行 HTML
R remove header line after placing Kable side by side in Rmarkdown generated HTML
我正在使用 Rmarkdown
生成一个 HTML 输出,其中两个 kables
使用 kable::kables
并排放置。但是,我想删除 side-by-side 电缆上方的额外一行。我读过 documentation of 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 = TRUE)
library(tidyverse)
library(rmarkdown)
library(kableExtra)
library(knitr)
```
## 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()
```
如果您知道如何删除该行,那就太好了!
您可以添加 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 = TRUE)
library(tidyverse)
library(rmarkdown)
library(kableExtra)
library(knitr)
```
<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()
```
我正在使用 Rmarkdown
生成一个 HTML 输出,其中两个 kables
使用 kable::kables
并排放置。但是,我想删除 side-by-side 电缆上方的额外一行。我读过 documentation of 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 = TRUE)
library(tidyverse)
library(rmarkdown)
library(kableExtra)
library(knitr)
```
## 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()
```
如果您知道如何删除该行,那就太好了!
您可以添加 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 = TRUE)
library(tidyverse)
library(rmarkdown)
library(kableExtra)
library(knitr)
```
<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()
```