Pander formats tables weirdly when using significance stars and pandoc

断了今生、忘了曾经 提交于 2019-12-12 16:47:06

问题


If I run a linear regression with significance stars, render it through pander, and "Knit PDF" such as this: pander(lm(crimerate ~ conscripted + birthyr + indigenous + naturalized, data = data), add.significance.stars = T)

I occasionally get output where there is weird spacing issues between rows in the output table.

I've tried setting pander options to report fewer digits panderOptions('digits', 2), but the problem persists.

Does anybody have any ideas?


回答1:


I had the same problem. Something is wrong with the cell alignment, this error disappeared when i changed style to rmarkdown.

library(data.table)
dt <- data.table(Test = c("0 - 10 000"),
                 ALDT = "99.18 %")

First(space in table):

pandoc.table(dt, justify = c("left", "right"))
# From pandoc below
------------------
   Test     ALDT  
---------- -------
0 - 10 000 99.18 %
------------------

Second(good formatting):

pandoc.table(dt, style = "rmarkdown", justify = c("left", "right"))
# From pandoc below
| Test          |    ALDT |
|:--------------|--------:|
| 0 - 10 000    | 99.18 % |

The first try doesn't work, something is wrong with the formatting pandoc gives us. But if you specify the style as rmarkdown it seems like the formatting is as it should be.



来源:https://stackoverflow.com/questions/36748706/pander-formats-tables-weirdly-when-using-significance-stars-and-pandoc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!