I have a dataset and I am able to get summary stats for it using stargazer easily and visually it comes out nice.
Now I want to compare summary stats for different subsets, such as gender for example, but I want the table to visually show the summary stats for all groups (ALL, MALE, FEMALE) side-by-side.
Can this be done easily?
# Summary Stats for Entire Sample (2016)
sumstat1 <- stargazer(subset(cps_data, YEAR == 2016),
type = 'text',
summary.stat = c('n','mean','sd'),
title = 'Summary Stats of Bay Area and Adjacent Counties in 2016')
# Summary Stats for Commuters (2016)
sumstat2 <- stargazer(subset(cps_data, YEAR == 2016 & Commuter == 1),
type = 'text',
summary.stat = c('n','mean','sd'),
title = 'Summary Stats of Commuters in Bay Area and Adjacent Counties in 2016')
# Summary Stats for Noncommuters (2016)
sumstat3 <- stargazer(subset(cps_data, YEAR == 2016 & Commuter == 0),
type = 'text',
summary.stat = c('n','mean','sd'),
title = 'Summary Stats of Noncommuters in Bay Area and Adjacent Counties in 2016')
stargazer(sumstat1,sumstat2,sumstat3,
type = "text")
The last line of code doesn't really work the same as when I input linear models.