On Thu, 2003-09-18 at 06:02, Bing Zhang wrote:
> Hi All,
> 
> I have a function, f(x,y)
> I have a matrix of data, m,  with the 1st column is x and the 2nd column is y
> What's the best way to get f(x,y) for each row of the matrix?
> I tried 
> result<-f(m[,1],m[,2]) but it doesn't work.

That is the best way, provided your function handles vectors nicely. 
Apparently, yours doesn't.

Next best is something like apply(m,2,f)

Cheers

Jason
-- 
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
+64-(0)21-343-545

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to