每次添加align = TRUE时,文档都不会编织。我想对齐每个列的系数,使它们的小数直接高于/低于对方。
这是我的"块代码"
```{r, results="asis", echo="FALSE", eval="TRUE"}
library(stargazer)
stargazer(model1, model2, model3, type = "latex",
title = "Country Deaths from Political Violence in 1975",
dep.var.labels.include = FALSE, dep.var.caption = "Deaths",
digits = 1, header = FALSE,
covariate.labels = c("Intercept", "Sanctions", "Political Rights",
"Upper 20 percent income share",
"Interaction of Political Rights and Sanctions"))
```
答案 0 :(得分:0)
使用align=TRUE
生成的tex表以
\begin{tabular}{@{\extracolsep{5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} }
在观星者身上应用gsub
并用\\cdot
替换这些点。然后使用cat
,为我解决了问题。
MWE:
table<-stargazer(example, align=TRUE)
tablenew<-gsub("D{.}{.}{-3} ","D.{\\cdot}{-3}",table,fixed=TRUE)
<<label, eval=TRUE, echo=FALSE, results='asis', warning=FALSE, message=FALSE>>=
knitrout<-cat(tablenwe, sep="\n")
@
一个缺点是\cdot
太高了。