如何在R Markdown(rmarkdown)html输出注释中显示有意义的星星? [英] How to show significance stars in R Markdown (rmarkdown) html output notes?

查看:250
本文介绍了如何在R Markdown(rmarkdown)html输出注释中显示有意义的星星?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用R Markdown在HTML文档中显示回归输出.我尝试了texregstargazer软件包.现在我的问题是,在笔记中我无法使意义的星星栩栩如生.由于自动生成,看来我无法逃脱它们.我一直在困惑 this ,但没有成功.我想念什么?非常感谢!

I want to show regression outputs in HTML documents using R Markdown. I tried the texreg and stargazerpackages. My problem is now, that in the notes I can't bring the significance stars to life. Due to automatic generation it seems I can't escape them. I've been puzzling around with this and this but with no success. What am I missing? Thanks a lot!!

以下是一些代码:

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

注意:问题是以前的 sub-问题我现在分开了.

Note: Question was a former sub-question I have now splitted.

推荐答案

对星号使用HTML实体:

Use the HTML entity for the asterisk:

star.symbol='&#42;'

请参见 http://www.ascii.cl/htmlcodes.htm .

您还可以手动添加传奇":

You could also add the "legend" manually:

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)

这篇关于如何在R Markdown(rmarkdown)html输出注释中显示有意义的星星?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆