0

Currently I´m doing my R syntax for my term paper and I want a Tabelle of my Desprictive Statistics from my analysis, so I tried the stargazer command, but it doesnt work. So maybe someone can help me?

Here is my command:

stargazer(michelM[,c("SRHMann", "EheMann", "ZusammenMann", "PartnerMann",
                     "KinderMann", "MigrationMann", "BildungMann", "AlterMann"
                       )], 
          out="summary_stats1.doc", 
          type="html", # for word 
          nobs = TRUE, mean.sd = TRUE, median = TRUE, iqr = TRUE,
          digits=2, align=T,
          title = "Summary Statistics", 
          covariate.labels=c("Gesundheit",
                             "Ehe","Zusammenleben","Partnerschaft",
                             "Kinder", "Migrationshintergrund","Bildung",
                             "Alter"))

As an result I get an empty table and I dont know why. So what can I do? Dont wonder, the variables are in german,because I´m from Germany. So sorry for my bad english.

MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Mar 05 '20 at 16:15

1 Answers1

0

I guess it's some problem with your data? Since all your components work in principle:

library(stargazer)

stargazer(mtcars, 
          #out="summary_stats1.doc",
          type = 'text', 
          nobs = TRUE, mean.sd = TRUE, median = TRUE, iqr = TRUE,
          digits=2, align=T,
          title = "Summary Statistics",
          covariate.labels=c("Gesundheit",
                             "Ehe","Zusammenleben","Partnerschaft",
                             "Kinder", "Migrationshintergrund","Bildung",
                             "Alter"))

Summary Statistics
================================================================================
Statistic             N   Mean   St. Dev.  Min   Pctl(25) Median Pctl(75)  Max  
--------------------------------------------------------------------------------
Gesundheit            32 20.091   6.027     10     15.4    19.2    22.8     34  
Ehe                   32  6.188   1.786     4       4       6       8       8   
Zusammenleben         32 230.722 123.939    71    120.8   196.3    326     472  
Partnerschaft         32 146.688  68.563    52     96.5    123     180     335  
Kinder                32  3.597   0.535   2.760   3.080   3.695   3.920   4.930 
Migrationshintergrund 32  3.217   0.978   1.513   2.581   3.325   3.610   5.424 
Bildung               32 17.849   1.787   14.500  16.892  17.710  18.900  22.900
Alter                 32  0.438   0.504     0       0       0       1       1   
am                    32  0.406   0.499     0       0       0       1       1   
gear                  32  3.688   0.738     3       3       4       4       5   
carb                  32  2.812   1.615     1       2       2       4       8   
--------------------------------------------------------------------------------
Marco
  • 2,368
  • 6
  • 22
  • 48