带额外kableExtra的表

z4bn682m  于 2023-01-06  发布在  其他
关注(0)|答案(1)|浏览(70)

我想使用kableExtra制作如图所示的表格。

我正在尝试使用下面的R代码块,但我得到了意外的结果。你能告诉我如何修复它吗?

```{r, echo=FALSE}
library(kableExtra)
df <- data.frame(
  Operator = c("`==`", "`!=`", "`>`", "`<`", "`>=`", "`<=`"),
  Interpretation = c("Equal to", "Not equal to", "Greater than", "Less than", "Greater than or equal to", "Less than or equal to")
)
df %>% kbl() %>% kable_styling(bootstrap_options = c('striped', 'hover', 'condensed'))

![](https://i.stack.imgur.com/nmpBm.png)
c3frrgcw

c3frrgcw1#

这是我能做的最接近

library(kableExtra)

df <- data.frame(
  Operator = c("==", "!=", ">", "<", ">=", "<="),
  Interpretation = c("Equal to", "Not equal to", "Greater than", "Less than", "Greater than or equal to", "Less than or equal to")
)

df %>% 
  kbl() %>% 
  kable_classic(full_width=F, html_font="Cambria") %>% 
  row_spec(0, bold=TRUE)

相关问题