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)
```
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)
```
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')
```