Re: [R] howto optimize operations between pairs of rows in a single matrix like cor and pairs

2008-08-25 Thread Adaikalavan Ramasamy
Thank you to Jim and Moshe. I will try the Rprof option as well as the running the function to run on columns instead. Thank you. jim holtman wrote: Use Rprof to see where time is being spent. If it is in FUN, then there is probably no way to "optimize" outside of changing the way FUN works.

Re: [R] howto optimize operations between pairs of rows in a single matrix like cor and pairs

2008-08-24 Thread jim holtman
Use Rprof to see where time is being spent. If it is in FUN, then there is probably no way to "optimize" outside of changing the way FUN works. So the first thing is to decide where time is being spent. On Sun, Aug 24, 2008 at 6:35 PM, Adaikalavan Ramasamy <[EMAIL PROTECTED]> wrote: > Hi, > > I

[R] howto optimize operations between pairs of rows in a single matrix like cor and pairs

2008-08-24 Thread Adaikalavan Ramasamy
Hi, I calculating the output of a function when applied to pairs of row from a single matrix or dataframe similar to how cor() and pairs() work. This is the code that I have been using: pairwise.apply <- function(x, FUN, ...){ n <- nrow(x) r <- rownames(x) output <-