[R] A problem with using the "outer" function

Duncan Murdoch dmurdoch at pair.com
Wed Jul 9 22:15:19 CEST 2003

On Wed, 09 Jul 2003 15:33:11 -0400, Ravi Varadhan <rvaradha at jhsph.edu>
wrote :

>I am using R 1.7.0 on Windows.  I am having trouble getting "outer" to 
>work on one of my functions. 

Most likely the problem is that the function you give doesn't work on
array arguments.  Your function needs to take two arrays of the same
shape as the first two arguments, and return an array of answers.
outer() doesn't work by looping, it works by constructing big arrays
of inputs and making just one function call.

Duncan Murdoch

More information about the R-help mailing list