[R] Calling stargazer() with do.call() in R 4.2.0

Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@tu-dortmund@de
Sat May 28 01:21:11 CEST 2022



On 27.05.2022 17:29, Arne Henningsen wrote:
> Dear all  (cc Marek = maintainer of the stargazer package)
> 
> We use do.call() to automatically create many LaTeX tables with
> stargazer but after upgrading to R 4.2.0, this no longer works. I
> illustrate this with a simple reproducible example:
> 
> R> data("USArrests")
> R> res <- lm( Murder ~ UrbanPop, data = USArrests )
> R> library(stargazer)
> R> stargazer(res)  # works as expected
> R> do.call( stargazer, list(res) )
> Error in if (is.na(s)) { : the condition has length > 1


Without looking at the code in detail: The line aboce suggests the code 
needs an any():    if(any(is.na(x))) raher than if(is.na(x)).

Best,
Uwe Ligges
> 
> Any ideas what we can do so that the last command works with R 4.2.0?
> 
> /Arne
>



More information about the R-help mailing list