From murdoch.duncan at gmail.com  Fri Jan 19 15:59:29 2018
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Fri, 19 Jan 2018 09:59:29 -0500
Subject: [Rd] bug fix integer overflow in medpolish function
In-Reply-To: <2111235670.59687.1516372405230.JavaMail.zimbra@vib-ugent.be>
References: <2111235670.59687.1516372405230.JavaMail.zimbra@vib-ugent.be>
Message-ID: <45e14c21-e85c-6f0e-6a22-f065c14bc21e@gmail.com>

On 19/01/2018 9:33 AM, Ludger Goeminne wrote:
> Dear R team
> 
> I noticed a bug in the "medpolish" function in the "stats" package.
> When I run medpolish(x), with "x" the matrix in the attached .rda file,
> I get this rather cryptic error:
> 
> "Error in if (converged) break : missing value where TRUE/FALSE needed
> In addition: Warning message:
> In sum(abs(z), na.rm = na.rm) : integer overflow - use sum(as.numeric(.))"
> 
> I traced this down to the line:
> 
> newsum <- sum(abs(z), na.rm = na.rm)
> 
> I think this "overflow" could be easily fixed by changing this line to:
> 
> newsum <- sum(as.numeric(abs(z)), na.rm = na.rm)

Alternatively, you could use medpolish(as.numeric(x)).

Duncan Murdoch



[Rd] bug fix integer overflow in medpolish function
Duncan Murdoch