减少列 header 名称在 Rmarkdown 中的 kable 表中的字体大小(ioslides)

Reducing column header names font size in kable tables in Rmarkdown (ioslides)

在我试图在 ioslides 中生成的所有 table 中,我得到的结果显示了大量的列名。我如何缩小它以使 table 看起来不错?

这是一个例子,但每个 table 都会发生同样的事情。我错过了什么?理想情况下,我希望 table 中的内容具有相同的字体大小。

降价:

## Test
``````{r, Test,echo=FALSE}
options("kableExtra.html.bsTable" = T)
kable(df, format= "html") %>%
  kable_styling(full_width = F, bootstrap_options = c("striped", "hover", "condensed"), font_size = 12.5)

我的输出图像:

您可以使用 row_spec()

更改行大小

由于 header 被解释为第 0 行,您可以独立更改 header 以满足您的需要。

尝试

kable(df, format= "html") %>%
  kable_styling(full_width = F, bootstrap_options = c("striped", "hover", "condensed"), font_size = 12.5) %>%
  row_spec(0, font_size=9)

有关更多设置,请查看 row_spec