From m@echler @ending from @t@t@m@th@ethz@ch  Mon Aug 20 10:30:28 2018
From: m@echler @ending from @t@t@m@th@ethz@ch (Martin Maechler)
Date: Mon, 20 Aug 2018 10:30:28 +0200
Subject: [Rd] image() method for Matrix fails on empty matrices (?)
In-Reply-To: <b708dbad-9062-0742-8297-8c6b85f4e0c5@gmail.com>
References: <b708dbad-9062-0742-8297-8c6b85f4e0c5@gmail.com>
Message-ID: <23418.31780.822283.881580@stat.math.ethz.ch>

>>>>> Ben Bolker 
>>>>>     on Sat, 18 Aug 2018 17:51:38 -0400 writes:

    >  Reasonably easy to avoid, but maybe an edge case that
    > should be handled?  Haven't looked yet to see how easy it
    > would be to fix ... Am I missing something?

No, I don't think so.

"Of course", we would typically not encounter this case, as we
typically would not visualize triviality ...

but nevertheless an edge case bug that I will fix immediately
and hence it will soon be available in the development version of
Matrix from R-forge e.g., by

   install.packages("Matrix", repos="http://R-Forge.R-project.org")

Thank you for the report, Ben!
Martin


> > library(Matrix)
> > m <- Matrix(0,nrow=3,ncol=3)
> > m
> 3 x 3 sparse Matrix of class "dsCMatrix"

> [1,] . . .
> [2,] . . .
> [3,] . . .
> > image(m)
> Error in seq.default(zrng[1], zrng[2], length.out = cuts + 2) :
>   'from' must be a finite number
> In addition: Warning messages:
> 1: In min(xx, na.rm = TRUE) :
>   no non-missing arguments to min; returning Inf
> 2: In min(x) : no non-missing arguments to min; returning Inf
> 3: In max(x) : no non-missing arguments to max; returning -Inf
> 4: In min(x) : no non-missing arguments to min; returning Inf
> 5: In max(x) : no non-missing arguments to max; returning -Inf

> ## now modify matrix
> > m[3,3] <- 1
> > image(m) ## works fine
> ## reset:
> > m[3,3] <- 0
> > image(m) ## fails again

> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] image() method for Matrix fails on empty matrices (?)
Martin Maechler