[R] Ploting a function of two arguments
Martin C. Martin
martin at metahuman.org
Fri Mar 11 01:52:29 CET 2005
Hi,
I've written a function:
myfun <- function(x, y) {
// blah blah
}
and I want to graph it. My plan is to use persp(), and my question is:
how do I create the array of values? One possibility is:
x <- seq(0, 10, by=.1)
y <- seq(0, 10, by=.1)
inputs <- <somehow create an array of x,y pairs>
outputs <- apply(A, c(1,2), myfun)
The "inputs" array would need to be 101x101x2 array, i.e. basically a 2D
array of pairs. I might need to write a little wrapper for myfun.
Am I on the right track, or is there an easier way to do this? It seems
there should be an easier way to graph a 2 argument function like this.
- Martin
More information about the R-help
mailing list