My dataset has a dummy variable which divides the data set into two groups. I would like to display the descriptive statistics for both next to each other, like:
using stargazer. Is this possible?
For example, if there is the mtcars data set and the variable $am divides the dataset into two groups, how can I display the one group on the left side and the other group on the other side?
Thank you!
I was able to display the two statistics below each other (I had to make two separate datasets for each group), but never next to each other.
treated <- mtcars[mtcars$am == 1,]
control <- mtcars[mtcars$am == 0,]
stargazer(treated, control, keep=c("mpg", "cyl", "disp", "hp"),
header=FALSE, title="Descriptive statistics", digits=1, type="text")