I just ran a series of models in a nice, flexible way that enforced data-code separation. I had a nice list of formulas and models in my configuration section which I lapply
'd over to get a list of model objects. Now I want to display them in stargazer
, but it doesn't take a list object. How do I do this without having to type out each list element?
Reproducible example:
require(stargazer)
l <- list()
l$lm1 <- lm(rating ~ complaints + privileges + learning + raises + critical,
data=attitude)
l$lm2 <- lm(rating ~ complaints + privileges + learning, data=attitude)
## create an indicator dependent variable, and run a probit model
attitude$high.rating <- (attitude$rating > 70)
l$prbt <- glm(high.rating ~ learning + critical + advance, data=attitude,
family = binomial(link = "probit"))
stargazer( l[[1]], l[[2]], l[[3]], title="Results", align=TRUE, type="text")