Re: [R] Beginner plot and map questions

From: <>
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. mailing list PLEASE do read the posting guide! 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