在Stargazer HTML回归表中未显示P值的重要性 [英] P-values significance not showed in stargazer html regression table

查看:348
本文介绍了在Stargazer HTML回归表中未显示P值的重要性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用观星者格式化html表时,Notes重要性(星号)没有出现是我的麻烦.使用乳胶的结果还可以.

I am having trouble with the Notes significance (asterisks) not appearing when using stargazer to format html tables. The result is ok when using latex.

这是我的源文件"teste.Rmd"

Here is my source file "teste.Rmd"

---
title: "Untitled"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```


```{r data}
#some data
set.seed(123)
X = rnorm(500,10,3)
Y = 10+ 3*I(X^1.2) + rnorm(500)
# models
m1 = lm(Y~X)
m2 = lm(Y~X+I(X^2))

```

```{r res,warning=FALSE,message=FALSE,results='asis'}
library(stargazer)
stargazer(m1,m2,type = 'html',title = 'Models' )

```

结果在下面

与乳胶相同会产生此

The same with latex produces this

如您所见,Notes中的星号使用乳胶而不是html选项正确格式化.如何使用html获得相同的行为?

As you can see the asterisks in Notes are formatted correctly with latex but not with html option. How to get the same behavior with html?

推荐答案

也许是@jaySf在原始问题的注释中所说的错误.但是基于@tmfmnk的答案和htmltools包,我以一种解决方法结束了.这是源文件中更新的相关部分.

Maybe it is a bug as @jaySf said in the comments to the original question. But based on @tmfmnk's answer and htmltools package I ended with a workaround. This is the updated relevant part of the source file.

```{r res,warning=FALSE,message=FALSE,results='hide'}
library(stargazer)
stargazer(m1,m2,type = 'html',title = 'Models', out = "table1.html")
```

```{r, echo=FALSE}
htmltools::includeHTML("table1.html")
```

现在我得到了预期的结果

Now I got the desired result

这篇关于在Stargazer HTML回归表中未显示P值的重要性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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