[R] Calling stargazer() with do.call() in R 4.2.0
Arne Henningsen
@rne@henn|ng@en @end|ng |rom gm@||@com
Sat May 28 22:40:34 CEST 2022
On Sat, 28 May 2022 at 01:21, Uwe Ligges
<ligges using statistik.tu-dortmund.de> wrote:
> 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)).
Yes, this is likely a problem in the 'stargazer' package.
... but why does the problem occur when using do.call( stargazer, )
but the problem does *not* occur when using stargazer() directly?
Best regards,
Arne
>> Any ideas what we can do so that the last command works with R 4.2.0?
>>
>> /Arne
--
Arne Henningsen
http://www.arne-henningsen.name
More information about the R-help
mailing list