5

我想使用 R Markdown 在 HTML 文档中显示回归输出。我尝试了texregstargazer包。我现在的问题是,在笔记中我无法将重要的星星带入生活。由于自动生成,我似乎无法逃脱它们。我一直在困惑这个这个,但没有成功。我错过了什么?非常感谢!!

这是一些代码:

```{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!
```

注意:问题是我现在拆分的以前的子问题。

4

1 回答 1

5

使用 HTML 实体作为星号:

star.symbol='&#42;'

http://www.ascii.cl/htmlcodes.htm

您也可以手动添加“图例”:

stargazer(lm1, type="html", notes = "<em>&#42;p&lt;0.1;&#42;&#42;p&lt;0.05;&#42;&#42;&#42;p&lt;0.01</em>", notes.append = F)

在此处输入图像描述

于 2017-06-10T14:33:07.680 回答