From: <vincent_at_7d4.com>

Date: Sat 15 Oct 2005 - 13:08:54 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Oct 15 13:13:05 2005

Date: Sat 15 Oct 2005 - 13:08:54 EST

Web User a écrit :

> 1.) Is there a way to convert a table (e.g. represented as a data frame)

*> to a function, specifying which columns are input and which column is
**> output? It would seem that this would be useful for plotting
**> experimental results, since e.g. contour(x, y, f) requires f to be a
**> function.
*

I think on something rather ugly.

Hopefully somebody will propose a more elegant solution.

1/ store your data in a global array myexpresults[,]
2/ define f(x,y) as

f function(x,y) {return(myexpresults[x,y]);};

x,y are integers and f is discrete in the above case. But if you want to allow x,y continuous, you can also interpolate in f() with the grid results the nearest from (x,y).

You can also do it without a global, by reading your table directly in f(), but this will demand to reread the table each time f is called which may be rather impracticable.

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Oct 15 13:13:05 2005

*
This archive was generated by hypermail 2.1.8
: Sun 23 Oct 2005 - 18:54:58 EST
*