[目前,我正在为我的学期论文使用R语法,我希望从我的分析中获得我的描述性统计数据表,因此我尝试了stargazer命令,但它不起作用。所以也许有人可以帮助我?
这是我的命令:
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"))
结果我得到一个空表,但我不知道为什么。那我该怎么办?不要奇怪,变量是德语的,因为我来自德国。非常抱歉我的英语不好。
我想您的数据有问题吗?由于您的所有组件原则上都可以工作:
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
--------------------------------------------------------------------------------