[英]R stargazer function produced table is not aligned
I have three regression and all variables name are identical.我有三个回归,所有变量名称都相同。
reg1<-lm(y~x1+x2+x3+x4,data=data1)
reg2<-lm(y~x1+x2+x3+x4,data=data2)
reg3<-lm(y~x1+x2+x3+x4,data=data3)
Then I try to do: stargazer(reg1,reg2,reg3,type="text",keep.stat = "all",align = TRUE)
然后我尝试这样做: stargazer(reg1,reg2,reg3,type="text",keep.stat = "all",align = TRUE)
The table is produced but misplaced (line 1, row 1-4 are the result for reg1, but line 2, row 5-8 are the result for reg 2, row 9-12 for reg3).该表已生成但放错了位置(第 1 行第 1-4 行是 reg1 的结果,但第 2 行第 5-8 行是 reg2 的结果,第 9-12 行是 reg3)。
Can anyone suggest?任何人都可以建议吗? Thanks谢谢
Can you go more into detail, what you expect the output to look like?你能更详细地描述一下,你期望输出是什么样的吗? When you use identical models (variables) with different datasets, I don't see misplaced output.当您对不同的数据集使用相同的模型(变量)时,我看不到错位的输出。
library("plm")
library("stargazer")
data("Produc", package = "plm")
model1 <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
data = Produc,
index = c("state","year"),
method="pooling")
model2 <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
data = Produc,
index = c("state","year"),
method="between")
model3 <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
data = Produc,
index = c("state","year"),
method="within")
stargazer(model1,model2,model3,type="text",keep.stat = "all",align = TRUE)
stargazer(model1,model2,model3,type="latex",keep.stat = "all",align = TRUE, out="output.tex")
Notice that the align
option only works in latex output and only if you have loaded the package dcolumn
.请注意, align
选项仅适用于乳胶输出,并且仅当您加载了dcolumn
包dcolumn
。 Latex, with and without the dcolumn
:乳胶,带和不带dcolumn
:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.