I am trying to use the package stargazer in RStudio to generate a summary table of my data. For some reason, I am not able to view the table in the output when I use either
To render a stargazer table in pdf you can add this code to an empty R markdown (.Rmd) file:
---
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(stargazer)
```
Here is the latex table in a PDF document:
```{r mylatextable, results = "asis"}
stargazer(attitude, type = 'latex')
```
Which appears as:

Exporting to word involves the following (taken from help(stargazer)):
To include stargazer tables in Microsoft Word documents (e.g., .doc or .docx), please follow the following procedure: Use the out argument to save output into an .htm or .html file. Open the resulting file in your web browser. Copy and paste the table from the web browser to your Microsoft Word document.
Alternatively, if the appearance of the table doesn't matter too much you can put the following in an empty .Rmd file:
---
output: word_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(stargazer)
```
Stargazer table in microsoft word:
```{r word_table, comment = ''}
stargazer(attitude, type = 'text')
```
Which results in a raw but readable table:
