-2

Why does my Stargazer function not output a table? It only outputs some texts when I make a PDF. Here is an example:

---
output: pdf_document
---

```{r cars}
stargazer::stargazer(mtcars)
```

enter image description here

Michael Harper
  • 14,721
  • 2
  • 60
  • 84
Bustergun
  • 977
  • 3
  • 11
  • 17

1 Answers1

3

You need to include results='asis' in the header. ALso header=FALSE suppresses the % Table created by stargazer header.

As explained in the RMarkdown guidance:

Note the use of the results='asis' chunk option. This is required to ensure that the raw table output isn’t processed further by knitr.

---
output: pdf_document
---

```{r mtcars, results='asis'}
stargazer::stargazer(mtcars,  header=FALSE, type='latex')
```

enter image description here

Michael Harper
  • 14,721
  • 2
  • 60
  • 84