3

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.

Phil
  • 7,287
  • 3
  • 36
  • 66
  • Can you include the data contents of df as per a reproducible example? https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – MBorg Mar 11 '20 at 09:39

1 Answers1

3

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

Marco
  • 2,368
  • 6
  • 22
  • 48