Skip to content

problems with outer (remainder of reply...)

2 messages · Bill Venables, Peter Dalgaard

#
[2nd go.  My previous message was suddenly dispatched before I had
finished.  Sorry about that - MicroSoft again, Sheesh!]
At 10:57 PM 5/6/00 -0400, Faheem Mitha wrote:

            
Yes it will handle it, but it may not speed things up very much.

You can think of outer as first doing a special kind of recycling, (the
same kind as is done in exapnd.grid in fact), calling the function you
supply once with expanded vector arguments with equal length and
re-arranging the result back into a matrix of the same form.

How do I know this?  I looked at the code for outer()!  It's only a couple
of lines long.

Bill Venables.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Bill Venables <Bill.Venables at cmis.csiro.au> writes:
Or, which is what I left out: When coming from outer, x and y *will*
have the same length, so one doesn't have to worry about recycling
rules. What the function sees is not the original x,y, but e.g.

x1 y1
x2 y1
x1 y2
x2 y2
x1 y3
x2 y3

Try outer(1:2,1:3,function(x,y)print(paste(x,y)))