2017-09-17 7 views
0

kable을 사용하여 실키 테이블을 인쇄하고 싶습니다.
마크 다운에서 코드를 실행할 때 실마리 테이블을 가져 오지만 표 앞에 해당 줄 사이에 부호가 | 인 여러 줄이 표시됩니다.
또한 처음에 경고 메시지가 :kable 여러 줄이있는 시가 테이블을 인쇄합니다.

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) 

내 출력은 다음과 같습니다

:

kable error when printing stargazer table

이 (일부 변경) 테이블에 대한 내 코드입니다

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) 

표가 인쇄되지만 여러 줄/직사각형 뒤에 만 인쇄됩니다. 다른 컴퓨터에서 코드를 실행 한 다음 문제가 발생하지 않았습니다. 이 문제의 원인은 무엇일까요?

+0

안녕하세요 @ michal, 당신은 실제 코드/테이블을 제공 할 수 있습니까? – Johnny

+0

안녕하세요 @ 조니, 방금 원래 질문을 수정하고 샘플 코드를 추가했습니다. 고맙습니다! – michal

답변

0

업데이트 : 많은 연구 끝에 나는 R 버전을 3.4.0에서 3.4.1로 업데이트 한 후에 만 ​​문제가 발생했다는 것을 알고있었습니다. 새 버전으로 업데이트 한 후 knitr 패키지를 1.16에서 1.17로 업데이트하고 해당 버전 만 언급 된 오류를 제공합니다. 그래서 knitr을 1.17에서 1.16으로 낮추었습니다. 문제가 해결되었습니다.