我想使用stargazer为分组变量的每个类别生成摘要统计信息.我可以在单独的表中完成它,但我喜欢它在一个 - 如果这对于这个包没有不合理的挑战.
例如
library(stargazer)
stargazer(ToothGrowth, type = "text")
#>
#> =========================================
#> Statistic N Mean St. Dev. Min Max
#> -----------------------------------------
#> len 60 18.813 7.649 4.200 33.900
#> dose 60 1.167 0.629 0.500 2.000
#> -----------------------------------------
Run Code Online (Sandbox Code Playgroud)
提供了连续变量的夏季统计数据ToothGrowth.我想用分类变量将该夏季分开supp,也在ToothGrowth.
对期望结果的两点建议,
stargazer(ToothGrowth ~ supp, type = "text")
#>
#> ==================================================
#> Statistic N Mean St. Dev. Min Max
#> --------------------------------------------------
#> OJ len 30 16.963 8.266 4.200 33.900
#> dose 30 …Run Code Online (Sandbox Code Playgroud)