[R] Surprise when mapping matrix to image

Deepayan Sarkar deepayan at cs.wisc.edu
Fri Aug 27 00:36:00 CEST 2004


Quoting "Glynn, Earl" <EFG at Stowers-Institute.org>:

> Prof Ripley:
> 
> Thank you for your prompt reply.
> 
> > It's pure convention: see below.
> > 
> > Did you try reading the help for image?  You don't seem to 
> > understand it
> > if you actually did.  It seems you are looking for
> > 
> >  image(t(x)[ncol(x):1, ])
> 
> I think you guys are too close to "R" to understand how hard it is to
> use sometimes.  What may be blatantly obvious to you is quite a problem
> especially to beginners.  Some of us may be beginners to R, but we know
> math, science, programming, and how to solve problems with other tools
> and languages.    
> 
> I re-read the guidelines before posting fearing condemnation.
> 
> Before posting I searched the online R-help Google interface with
> keywords "image", "flip", "rotate".  A discussion from 1998 touched on
> this issue but I was hoping that this was deemed a "bug" at some point
> and fixed -- or had an easy workaround, like some parameter I was
> missing.
> 
> I read the "?image" help before posting. Was the part I didn't
> understand buried in this "note"?
> 
>      "Based on a function by Thomas Lumley tlumley at u.washington.edu."

You seem to be thinking that Prof Ripley's solution had something to do with
image(). It doesn't, it has to do with manipulating a matrix. image()
visualizes a matrix in a particular and well-defined way. You want your matrix
to be shown in a different way, and one (simple) way of doing that is to
convert your matrix into a different matrix, on which calling image would give
you what you want. Why would this be explained in ?image ? This is basic R.

More generally, I think your frustration is caused by your expectation that a
matrix object should behave like a bitmap image. It doesn't. If you want work
with images, use the pixmap package.

Deepayan




More information about the R-help mailing list