I would like to use stargazer to produce summary statistics for each category of a grouping variable. I could do it in separate tables, but I\'d like it all in one – if that
invisible(lapply(levels(ToothGrowth$supp),stargazer))
would do, but if you want separate \subsection{} in between, you probable should use something like
invisible(lapply(levels(ToothGrowth$supp),function(sg){ cat("\\subsection{add your text here}\n") print(stargazer(sg) })