Stargazer 仅输出 table 的 header
Stargazer only outputs the header of table
我只是想用 stargazer 创建一个 table 来显示我的变量的一些描述性统计数据,但 stargazer 只输出 table 的 header。我也试过 type = "html",但我遇到了同样的问题。我不确定这里的问题是什么,任何人都可以帮助我吗?
structure(list(ADPT_1 = c(4, 4, 2, 1, 5, 2, 4, 5, 4, 3), ADPT_2 = c(4,
4, 1, 1, 5, 2, 4, 5, 2, 4), ADPT_3 = c(2, 4, 1, 1, 5, 4, 3, 5,
2, 2), RE_1 = c(4, 3, 4, 4, 5, 2, 4, 4, 3, 5), RE_2 = c(4, 4,
2, 5, 5, 2, 4, 4, 4, 4), RE_3 = c(4, 4, 3, 5, 5, 2, 3, 5, 4,
5), RE_4 = c(3, 3, 3, 5, 5, 2, 4, 4, 3, 4), COMP_1 = c(3, 3,
1, 3, 5, 1, 3, 2, 1, 3), COMP_2 = c(4, 4, 3, 5, 5, 1, 4, 4, 2,
3), COMP_3 = c(4, 4, 4, 3, 3, 1, 4, 4, 3, 3), PLEX_1 = c(4, 3,
3, 3, 1, 5, 2, 2, 3, 3), PLEX_2 = c(4, 4, 4, 4, 2, 5, 2, 2, 4,
2), PLEX_3 = c(3, 2, 2, 3, 2, 5, 3, 2, 3, 2), ORG_1 = c(4, 4,
2, 4, 5, 3, 4, 4, 5, 4), ORG_2 = c(3, 4, 2, 1, 5, 2, 4, 4, 3,
3), ORG_3 = c(3, 3, 1, 1, 4, 1, 3, 4, 1, 3), TOP_1 = c(4, 4,
1, 2, 5, 1, 4, 4, 3, 4), TOP_2 = c(4, 3, 2, 2, 5, 1, 5, 4, 4,
4), TOP_3 = c(4, 3, 3, 4, 5, 1, 4, 4, 3, 5), PRES_1 = c(2, 2,
1, 2, 5, 1, 3, 2, 2, 5), PRES_2 = c(3, 3, 3, 3, 5, 1, 2, 4, 2,
3), PRES_3 = c(2, 2, 1, 2, 5, 1, 3, 2, 3, 4), REG_1 = c(3, 3,
2, 2, 4, 3, 2, 4, 1, 3), REG_2 = c(3, 3, 2, 3, 3, 2, 3, 2, 2,
3), REG_3 = c(3, 3, 3, 4, 3, 5, 2, 2, 2, 4)), row.names = c(NA,
10L), class = "data.frame")
This blog post提示需要使用as.matrix()
:
stargazer(as.matrix(psych::describe(x)),type="text")
(我使用 type="text"
来使这里的内容更易于剪切和粘贴)
===================================================================================
vars n mean sd median trimmed mad min max range skew kurtosis se
-----------------------------------------------------------------------------------
ADPT_1 1 10 3.400 1.350 4 3.500 1.483 1 5 4 -0.420 -1.358 0.427
ADPT_2 2 10 3.200 1.549 4 3.250 1.483 1 5 4 -0.297 -1.722 0.490
ADPT_3 3 10 2.900 1.524 2.500 2.875 2.224 1 5 4 0.149 -1.705 0.482
RE_1 4 10 3.800 0.919 4 3.875 0.741 2 5 3 -0.433 -0.830 0.291
RE_2 5 10 3.800 1.033 4 3.875 0 2 5 3 -0.741 -0.789 0.327
RE_3 6 10 4 1.054 4 4.125 1.483 2 5 3 -0.512 -1.218 0.333
RE_4 7 10 3.600 0.966 3.500 3.625 0.741 2 5 3 0.080 -1.297 0.306
COMP_1 8 10 2.500 1.269 3 2.375 0.741 1 5 4 0.293 -0.896 0.401
COMP_2 9 10 3.500 1.269 4 3.625 1.483 1 5 4 -0.587 -0.896 0.401
COMP_3 10 10 3.300 0.949 3.500 3.500 0.741 1 4 3 -1.237 0.607 0.300
PLEX_1 11 10 2.900 1.101 3 2.875 0.741 1 5 4 0.171 -0.596 0.348
PLEX_2 12 10 3.300 1.160 4 3.250 0.741 2 5 3 -0.139 -1.839 0.367
PLEX_3 13 10 2.700 0.949 2.500 2.500 0.741 2 5 3 1.237 0.607 0.300
ORG_1 14 10 3.900 0.876 4 4 0 2 5 3 -0.733 -0.173 0.277
ORG_2 15 10 3.100 1.197 3 3.125 1.483 1 5 4 -0.168 -1.181 0.379
ORG_3 16 10 2.400 1.265 3 2.375 1.483 1 4 3 -0.095 -1.867 0.400
TOP_1 17 10 3.200 1.398 4 3.250 0.741 1 5 4 -0.535 -1.393 0.442
TOP_2 18 10 3.400 1.350 4 3.500 1.483 1 5 4 -0.420 -1.358 0.427
TOP_3 19 10 3.600 1.174 4 3.750 1.483 1 5 4 -0.772 -0.162 0.371
PRES_1 20 10 2.500 1.434 2 2.375 0.741 1 5 4 0.814 -0.903 0.453
PRES_2 21 10 2.900 1.101 3 2.875 0.741 1 5 4 0.171 -0.596 0.348
PRES_3 22 10 2.500 1.269 2 2.375 1.483 1 5 4 0.587 -0.896 0.401
REG_1 23 10 2.700 0.949 3 2.750 1.483 1 4 3 -0.169 -1.171 0.300
REG_2 24 10 2.600 0.516 3 2.625 0 2 3 1 -0.349 -2.055 0.163
REG_3 25 10 3.100 0.994 3 3 1.483 2 5 3 0.439 -1.084 0.314
-----------------------------------------------------------------------------------
我只是想用 stargazer 创建一个 table 来显示我的变量的一些描述性统计数据,但 stargazer 只输出 table 的 header。我也试过 type = "html",但我遇到了同样的问题。我不确定这里的问题是什么,任何人都可以帮助我吗?
structure(list(ADPT_1 = c(4, 4, 2, 1, 5, 2, 4, 5, 4, 3), ADPT_2 = c(4,
4, 1, 1, 5, 2, 4, 5, 2, 4), ADPT_3 = c(2, 4, 1, 1, 5, 4, 3, 5,
2, 2), RE_1 = c(4, 3, 4, 4, 5, 2, 4, 4, 3, 5), RE_2 = c(4, 4,
2, 5, 5, 2, 4, 4, 4, 4), RE_3 = c(4, 4, 3, 5, 5, 2, 3, 5, 4,
5), RE_4 = c(3, 3, 3, 5, 5, 2, 4, 4, 3, 4), COMP_1 = c(3, 3,
1, 3, 5, 1, 3, 2, 1, 3), COMP_2 = c(4, 4, 3, 5, 5, 1, 4, 4, 2,
3), COMP_3 = c(4, 4, 4, 3, 3, 1, 4, 4, 3, 3), PLEX_1 = c(4, 3,
3, 3, 1, 5, 2, 2, 3, 3), PLEX_2 = c(4, 4, 4, 4, 2, 5, 2, 2, 4,
2), PLEX_3 = c(3, 2, 2, 3, 2, 5, 3, 2, 3, 2), ORG_1 = c(4, 4,
2, 4, 5, 3, 4, 4, 5, 4), ORG_2 = c(3, 4, 2, 1, 5, 2, 4, 4, 3,
3), ORG_3 = c(3, 3, 1, 1, 4, 1, 3, 4, 1, 3), TOP_1 = c(4, 4,
1, 2, 5, 1, 4, 4, 3, 4), TOP_2 = c(4, 3, 2, 2, 5, 1, 5, 4, 4,
4), TOP_3 = c(4, 3, 3, 4, 5, 1, 4, 4, 3, 5), PRES_1 = c(2, 2,
1, 2, 5, 1, 3, 2, 2, 5), PRES_2 = c(3, 3, 3, 3, 5, 1, 2, 4, 2,
3), PRES_3 = c(2, 2, 1, 2, 5, 1, 3, 2, 3, 4), REG_1 = c(3, 3,
2, 2, 4, 3, 2, 4, 1, 3), REG_2 = c(3, 3, 2, 3, 3, 2, 3, 2, 2,
3), REG_3 = c(3, 3, 3, 4, 3, 5, 2, 2, 2, 4)), row.names = c(NA,
10L), class = "data.frame")
This blog post提示需要使用as.matrix()
:
stargazer(as.matrix(psych::describe(x)),type="text")
(我使用 type="text"
来使这里的内容更易于剪切和粘贴)
===================================================================================
vars n mean sd median trimmed mad min max range skew kurtosis se
-----------------------------------------------------------------------------------
ADPT_1 1 10 3.400 1.350 4 3.500 1.483 1 5 4 -0.420 -1.358 0.427
ADPT_2 2 10 3.200 1.549 4 3.250 1.483 1 5 4 -0.297 -1.722 0.490
ADPT_3 3 10 2.900 1.524 2.500 2.875 2.224 1 5 4 0.149 -1.705 0.482
RE_1 4 10 3.800 0.919 4 3.875 0.741 2 5 3 -0.433 -0.830 0.291
RE_2 5 10 3.800 1.033 4 3.875 0 2 5 3 -0.741 -0.789 0.327
RE_3 6 10 4 1.054 4 4.125 1.483 2 5 3 -0.512 -1.218 0.333
RE_4 7 10 3.600 0.966 3.500 3.625 0.741 2 5 3 0.080 -1.297 0.306
COMP_1 8 10 2.500 1.269 3 2.375 0.741 1 5 4 0.293 -0.896 0.401
COMP_2 9 10 3.500 1.269 4 3.625 1.483 1 5 4 -0.587 -0.896 0.401
COMP_3 10 10 3.300 0.949 3.500 3.500 0.741 1 4 3 -1.237 0.607 0.300
PLEX_1 11 10 2.900 1.101 3 2.875 0.741 1 5 4 0.171 -0.596 0.348
PLEX_2 12 10 3.300 1.160 4 3.250 0.741 2 5 3 -0.139 -1.839 0.367
PLEX_3 13 10 2.700 0.949 2.500 2.500 0.741 2 5 3 1.237 0.607 0.300
ORG_1 14 10 3.900 0.876 4 4 0 2 5 3 -0.733 -0.173 0.277
ORG_2 15 10 3.100 1.197 3 3.125 1.483 1 5 4 -0.168 -1.181 0.379
ORG_3 16 10 2.400 1.265 3 2.375 1.483 1 4 3 -0.095 -1.867 0.400
TOP_1 17 10 3.200 1.398 4 3.250 0.741 1 5 4 -0.535 -1.393 0.442
TOP_2 18 10 3.400 1.350 4 3.500 1.483 1 5 4 -0.420 -1.358 0.427
TOP_3 19 10 3.600 1.174 4 3.750 1.483 1 5 4 -0.772 -0.162 0.371
PRES_1 20 10 2.500 1.434 2 2.375 0.741 1 5 4 0.814 -0.903 0.453
PRES_2 21 10 2.900 1.101 3 2.875 0.741 1 5 4 0.171 -0.596 0.348
PRES_3 22 10 2.500 1.269 2 2.375 1.483 1 5 4 0.587 -0.896 0.401
REG_1 23 10 2.700 0.949 3 2.750 1.483 1 4 3 -0.169 -1.171 0.300
REG_2 24 10 2.600 0.516 3 2.625 0 2 3 1 -0.349 -2.055 0.163
REG_3 25 10 3.100 0.994 3 3 1.483 2 5 3 0.439 -1.084 0.314
-----------------------------------------------------------------------------------