kable() col 标题可以并排特殊符号吗?

问题描述 投票:0回答:1

这不是并排打印不同的

kable()
表格的问题。

使用 Markdown、PDF 输出。我的列标题是希腊符号 delta。我想添加一列,其标题是希腊符号 delta 与 % 符号并排,但我不知道如何实现这一点。

这是我得到的:

test_results <- dplyr::data_frame ('First Score'=c(42.35), 'Second Score'=c(90.4), '$\\Delta$'=c(48.05))

kable(test_results, align = "ccc", caption = "Test Results Data", format="latex", position = "h!", escape = FALSE) %>% row_spec(0,bold=TRUE) %>% 
kable_styling()

感谢您的帮助!

r latex kable
1个回答
0
投票
```{r }

library(kableExtra)
library(dplyr)

test_results <- dplyr::tibble ('First Score'=c(42.35), 
                               'Second Score'=c(90.4), 
                               '$\\Delta$\\%'=c(48.05))

kable(test_results, 
      align = "ccc",
      caption = "Test Results Data", 
      format="latex", 
      position = "h!", 
      escape = FALSE) |> 
  row_spec(0,bold=TRUE) |>  
  kable_styling()


```
© www.soinside.com 2019 - 2024. All rights reserved.