[R] Surprise when mapping matrix to image

Glynn, Earl EFG at Stowers-Institute.org
Thu Aug 26 23:47:16 CEST 2004


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."

I asked the question because I did not find the answer under "?image".
Please quote the portion that I missed that you think explains this.  I
was tempted to post the whole "?image" section here to prove my point.
There is no entry on that page with transpose, "t(", or "ncol" the way
you explained above. I'm not sure what you think I missed, but I did my
homework on this problem before posting.
 
> Easy!
> 
> Mathematical conventions are just that, conventions.  They 
> differ by field 
> of mathematics.  Don't ask us why matrix rows are numbered 
> down but graphs 
> are numbered up the y axis, nor why x comes before y but row before 
> column.  But the matrix layout has always seemed illogical to me.

My 30+ years of software experience says this is a design flaw.  A good
design would reconcile the differences between conventions.  Coordinate
transformations are not that hard, but I wouldn't burden the end-user
with them needlessly.

I'll go back to lurking in the daily R-Helps and not ask any more
questions until I've read all the old R-help messages.  I'm working on
December 1998 right now and reading forward.  Perhaps by next year I'll
will have read all the old R-help postings and I'll dare ask another
question then.

efg




More information about the R-help mailing list