image stops detecting wrong sized z matrix (PR#352)
Tue, 30 Nov 1999 15:16:55 +0100 (MET)


> This is where example(krige) from library(sgeostat) stops with R 0.90.0:
> krige> image(grid$x, grid$y, grid$krige$zhat, add = T)
> Error in length(x) == nrow(z) : comparison (1) is possible only for vector
> types
> in previous versions of R the above image() call worked, because image()
> did the transformation 
>   grid$krige$zhat -> matrix(grid$krige$zhat,length(grid$x),length(grid$x))
> iself. (BTW, contour() didn't)

(In fact, it just ignored dim(z) which therefore could be null.)

> Was this change of behaviour in image() made intentionally? 

Yes, to allow a more general specification of x and y, for S compatibility
(and general usefulness!).

I believe this is a bug in sgeostat not in R: it has long been
documented that z should be a matrix. What has happened is that we
now make use of the documented behaviour.  Suppose z were of length 90,
and each of x and y were of length 10. That is now ambiguous (and BTW,
just gave the wrong plot in 0.65.1, something that has caught me
more than once).

I will add a more specific error message testing that z is a matrix.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: