【问题标题】:Plot a table in Rmarkdown beamer with stargazer使用 stargazer 在 Rmarkdown beamer 中绘制表格
【发布时间】:2018-06-20 17:52:49
【问题描述】:

我正在尝试在我的 beamer rmarkdown 演示文稿中绘制回归摘要。使用观星功能,我这样做了

```{r, echo = T , comment =  "" , message=FALSE, warning=FALSE }
regra_taylor_0 <- dynlm(selic ~ lag(selic,-1) + desvio + hiato, data=data_estimacao_ts)

```

```{r, echo = F , comment =  "" , message=FALSE, warning=FALSE}

stargazer(regra_taylor_0 )


```

但是预设中的结果是这样的

% Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: qua, jun 20, 2018 - 14:47:05
\begin{table}[!htbp] \centering
\caption{}
\label{}
\begin{tabular}{@{\extracolsep{5pt}}lc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& \multicolumn{1}{c}{\textit{Dependent variable:}} \\
\cline{2-2}
\\[-1.8ex] & selic \\
\hline \\[-1.8ex]
lag(selic, -1) & 0.962$^{***}$ \\
& (0.036) \\
& \\

请帮忙

【问题讨论】:

  • 现在,出现了一些不完整的表格。但在表格之前,我有这个“% Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu % 日期和时间:qua,2018 年 6 月 20 日 - 15 日: 04:18"
  • @eipi10 喜欢这个? ## 结果adp {r, echo = T , comment = "" , message=FALSE, warning=FALSE, results="asis" , xtable.comment = FALSE} stargazer(regra_taylor_0 )
  • 我这样做了,但它不起作用
  • {r, echo = F , comment = "" , message=FALSE, warning=FALSE, results="asis"} options(xtable.comment = FALSE) stargazer(regra_taylor_0 , font.size = 'footnotesize' )
  • 而且 size 参数也不起作用。你知道如何调整表格的大小吗?

标签: r r-markdown


【解决方案1】:

这是一个最小的示例,演示了如何获得所需的 stargazer 输出以及删除 stargazer 评论消息:

---
output: pdf_document
---

```{r setup, include=FALSE}
# You can set chunk options globally so you don't have to repeat them in every chunk
knitr::opts_chunk$set(echo = TRUE, message=FALSE, warning=FALSE)

library(stargazer)
```

```{r, results='asis'}
stargazer(lm(mpg ~ wt, data=mtcars), header=FALSE)
```

If you want to change and option for a specific chunk, you can do add a chunk option
like echo=FALSE.


```{r, results='asis', echo=FALSE}
stargazer(lm(mpg ~ wt + hp + vs, data=mtcars), header=FALSE)
```

```{r, results='asis'}
# Change the font size with the font.size argument. See the help for size options
stargazer(lm(mpg ~ wt + hp + vs, data=mtcars), header=FALSE, font.size = "scriptsize")
```

【讨论】:

  • 好的,它正在工作。你知道如何减小表格的大小吗?
猜你喜欢
  • 2015-03-16
  • 2017-12-29
  • 2017-03-24
  • 2017-04-22
  • 1970-01-01
  • 2023-03-25
  • 1970-01-01
  • 1970-01-01
  • 2017-08-01
相关资源
最近更新 更多