How to change fontface (bold/italics) for a cell in a kable table in rmarkdown?

前端 未结 3 1043
逝去的感伤
逝去的感伤 2020-12-06 06:09

Is there a way to format a single cell in a table in rmarkdown? I am using kable to generate a table as follows:

library(knitr)
kable(data.frame(c(\'a\',\'b\         


        
3条回答
  •  我在风中等你
    2020-12-06 06:49

    Highlighting cells, rows or columns with pander is pretty straightforward:

    > df <- data.frame(c('a','b','c'),c(1,2,3))
    > emphasize.strong.cells(which(df == 3, arr.ind = TRUE))
    > pander(df)
    
    -------------------------------
     c..a....b....c..   c.1..2..3. 
    ------------------ ------------
            a               1      
    
            b               2      
    
            c             **3**    
    -------------------------------
    

    But adding horizontal line to the table is out of the scope of markdown table specifications.

提交回复
热议问题