[R] outer

Erich Neuwirth erich.neuwirth at univie.ac.at
Sun Sep 23 16:55:17 CEST 2001

i cannot cajole outer in doing what i want it to do.

i hav a function only defined for scalars

and i want to do

outer(1:5,1:5,function(x,y) fun(x,y))
(i know this is written somewhat clumsy)

to get an array with the values of fun
to use it as an input for image

this does not work since
outer assumes then fun works on arrays elementwise.

what is the easiest way of getting what i want?

outer in some lisp like variants and in mathematica will work with the
function argument being a
scalar argument only function.
r is different here.

Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
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

More information about the R-help mailing list