我希望使用R Markdown在HTML文档中展示回归输出。我尝试了
texreg
和stargazer
包。问题是,在注释中,我无法将显着性星号显示出来。由于自动生成,似乎我无法逃脱它们。我一直在研究这个 和 这个,但没有成功。我错过了什么?非常感谢!
以下是一些代码:
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r data}
library(car)
lm1 <- lm(prestige ~ income + education, data=Duncan)
```
## with STARGAZER
```{r table1, results = "asis", message=FALSE}
library(stargazer)
stargazer(lm1, type="html", notes="stargazer html 1") # nothing
stargazer(lm1, type="html", notes="stargazer html 2", star.char = "\\*") # nothing, even gone in table
```
## with TEXREG
```{r table2, results = "asis", message=FALSE}
library(texreg)
htmlreg(lm1, custom.note="%stars. htmlreg") # nothing
htmlreg(lm1, custom.note="%stars. htmlreg", star.symbol = "\\*") # still nothing!
```
注意: 这个问题曾经是一个子问题,现在已分开处理。
star.symbol='*'
吗? - Martin Schmelzertexreg/htmlreg
配合使用效果非常好,谢谢!在stargazer
中没有变化,即使设置了star.char = 'x'
也是如此。我的结论是在 html 中使用前者,在 latex 中使用后者。 - jay.sf