How do I call stargazer on a list of models? How do I call stargazer on a list of models? r r

How do I call stargazer on a list of models?


Please make sure you are using an up-to-date version of the package. Starting with version 4.5.3 (available on CRAN since Nov 2013), stargazer has been able to accept lists of object in exactly the way you would expect:

stargazer(l, title="Results", align=TRUE, type="text")


Use do.call:

do.call( stargazer, l ) 

However, this precludes passing in arguments in the usual way:

> do.call( stargazer, l, type="text" )Error in do.call(stargazer, l, type = "text") :   unused argument (type = "text")

Therefore, you have to add the named arguments to the list:

l$type <- "text"l$align <- TRUEl$title <- "Results"do.call( stargazer, l )

Another way to do this is to curry the stargazer function:

require(functional)sgCurried <- Curry( stargazer, type="text" ) # all arguments to stargazer go in heredo.call( sgCurried, l )