Skip to content
Prev 5523 / 398506 Next

3D array was L(x,y,t)?

Hi Bill,
Well your function does not appear to need outer at all.  If you want to
create a n-D array of function values over a grid in n variables and your
function is simple, as yours appears to be, you can just use (for your
example)

grid <- expand.grid(x=seq(1, 66), y=seq(1, 31), time=seq(1, 19))
grid <- as.matrix(grid)
z0 <- apply(grid, 1, function(v) f0(v[1], v[2], v[3]))

(although this is not optimal!).  Then just dim(z0) appropriately.

However, your functions do appear to be a bit strange.  Can it be right
that y appears nowhere in the body of either f0 or f1?
Cheers, Jonathan.

Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE
http://www.maths.dur.ac.uk/stats/people/jcr/jcr.html

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