I want to print stargazer table using kable.
When I am running the code in markdown, I get the stargazer table but with multiple lines with the sign |
between those lines before the table.
I also get a warning message at the beginning:
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)
my output looks like this:
This is my code for the table (with some changes):
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)
and in a new chunk:
kable(my.stg)
The table is printed but only after the multiple lines / rectangles. I also ran the code from other computers and then the problem did not happen. What could cause this?
Update : after a lot of research, i recognized that the problem occurred only after updating my R version from 3.4.0 to 3.4.1. After updating to the new version, it also made me update knitr package from 1.16 to 1.17 and only that version gives the mentioned error. So, i downgraded knitr from 1.17 to 1.16 and that solved the problem.