[R-SIG-Mac]Re: A mac/win difference in R1.4.0

Peter Macdonald pdmmac@mcmail.cis.mcmaster.ca
Mon, 14 Jan 2002 19:31:08 -0500 (EST)


Here is a simpler example of the inconsistency:

On Windows R 1.4.0

> if(NULL == "A") print("Yes") else print("No")
Error in if (NULL == "A") print("Yes") else print("No") :
        missing value where logical needed

On Mac R 1.4.0

> if(NULL == "A") print("Yes") else print("No")
[1] "No"

*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
 Peter D.M. Macdonald, D.Phil.      McMaster University
 Professor of Math & Statistics     Hamilton, Ontario, Canada L8S 4K1
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*


On Sat, 12 Jan 2002, Peter Macdonald wrote:

> Can anyone give me insight on this or suggest a better way? Thanks!
>
> On the Mac I can write
>
>     invmat <- try(solve(hessian/2))
>     if (class(invmat) == "try-error")
>         invmat <- matrix(NA, nrow = nrow(hessian), ncol = ncol(hessian))
>
> But in Windows I have to add a test for null class or I get a fatal error
> at the == when class is null
>
>     invmat <- try(solve(hessian/2))
>     if (!is.null(class(invmat)))
>         if (class(invmat) == "try-error")
>             invmat <- matrix(NA, nrow = nrow(hessian), ncol =
> ncol(hessian))
>
>
> *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
>  Peter D.M. Macdonald, D.Phil.      McMaster University
>  Professor of Math & Statistics     Hamilton, Ontario, Canada L8S 4K1
> *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
>
>
>