【发布时间】:2018-02-25 23:09:29
【问题描述】:
我想使用 kable 打印 stargazer 表。
当我在 markdown 中运行代码时,我得到了 stargazer 表,但在表之前的这些行之间有多行带有符号 |。
我还在开头收到一条警告消息:
Warning in kable_markdown(x = structure(c("", "<table style=\"text-
align:center\"><caption><strong>Crude models: OR for mRS at discharge >3
with 95% CI</strong></caption>", : The table should have a header (column
names)
我的输出如下所示:
这是我的表格代码(有一些更改):
mod.example1 <- glm(bad_outcome~x1+x2+x3+x4, family = "binomial", data = dat0)
mod.example2 <- glm(bad_outcome~x1+x2+x3+x4, family = "binomial", data = dat1)
CI.list <- list(exp(confint(mod.example1)),exp(confint(mod.example2)))
my.stg <- stargazer(
title = "my models: OR for bad outcome",
mod.example1
mod.example2,
type="html",
digits = 2,
t.auto = FALSE,
model.numbers = F,
keep.stat = "n",
report = c("vc*sp"),
omit = "Constant",
star.cutoffs = c(0.05,0.01,0.001),
no.space = FALSE,
single.row = F,
dep.var.labels = c("***bad outcome***"),
covariate.labels = c("x1","x2","x3","x4"),
column.labels = c("-**dat0**-", "-**dat1**-"),
ci= T,
ci.custom = CI.list,
apply.coef=exp)
在一个新的块中:
kable(my.stg)
表格被打印但仅在多行/矩形之后。 我还从其他计算机上运行了代码,然后问题没有发生。 这是什么原因造成的?
【问题讨论】:
-
嗨@michal,你能提供实际的代码/表格吗?
-
嗨@Johnny,我刚刚编辑了我的原始问题并添加了示例代码。谢谢!
标签: r knitr r-markdown stargazer kable