How to create a table with descriptive statistics in Rstudio (stargazer)?

I am currently learning RStudio (beginner level) and I have a question regarding stargazer function and especially how to create the table of descriptive statistics. I did start by updloading my dataset (called df1) and all relevant libraries like stargazer. I did run command line:

stargazer(df1, type = "text", title = "Descriptive statistics", digits = 1, out = "table1.txt")´

The dataset contains statistics regarding delays at Norway's four biggest airports from the four biggest airlines. I would like to find min, max, standard deviation and mean and present it in a table to summarise the findings. The current command (shown above) only shows the header of the table but without contents.

Upvotes: 3

Views: 6152

Answers (1)

Marco
Marco

Reputation: 2827

You can put in a dataframe in stargazer and will get descriptive statistics as default.

library(stargazer)

stargazer(mtcars, 
          type = 'text', min.max=TRUE, mean.sd = TRUE, 
          nobs = FALSE, median = FALSE, iqr = FALSE,
          digits=1, align=T,
          title = "Summary Statistics")

If this is not working properly, check your dataframe. As MBorg said, can you provide some reproducible example? Kind regards

Upvotes: 3

Related Questions