【发布时间】:2020-11-07 06:22:40
【问题描述】:
我正在尝试以与我通常为回归表所做的类似方式获得几个方差分析的良好发布准备输出。代码看起来有点像:
head(iris)
library(car)
# run model 1
lm1 <- lm(Sepal.Length ~ Species, data = iris)
summary(lm1)
a1 <- Anova(lm1)
# run model 2
lm2 <- lm(Petal.Width ~ Species, data = iris)
summary(lm2) # long format (regression type output)
a2 <- Anova(lm2) # short format (anova type output, which I need)
# what I usually do for regression outputs:
library(stargazer)
stargazer(lm1, lm2, type = "html", out ="iris.html")
# which yields a nice table with models side by side, including dependent variable names for each model;
# this one I'd export as .html to Word and process there
# trying a similar joint table for anova type output:
stargazer(a1, a2, type = "html", out ="iris2.html")
# ... but that yields 2 separated tables and they can't be distinguished by dependent variables etc
# same problem here:
table <- rbind(a1, a2)
write.csv(as.data.frame(table), file = "iris2.csv")
# when I do this, I only get the same two tables underneath each other with their columnwise headers,
# but without the distinguishing dependent variables
由于我必须一遍又一遍地处理更多模型,因此我希望 Word 中的后期处理尽可能少。 我知道使用 LaTeX 有非常好的解决方案,但不幸的是,由于合著者,这些完全不可能。我使用了“xtable”、“pixiedust”和“export”包,但没有得到我想要的结果。
希望有人能帮忙, 提前致谢!
【问题讨论】:
-
你为什么不使用非常好的 LaTeX 解决方案并将 .pdf 放入 word 中?
-
R 降价是怎么回事?