[R] vectorization instead of using loop

2008-10-09 Thread Frank Hedler
Dear all, I've sent this question 2 days ago and got response from Sarah. Thanks for that. But unfortunately, it did not really solve our problem. The main issue is that we want to use our own (manipulated) covariance matrix in the calculation of the mahalanobis distance. Does anyone know how to ve

Re: [R] vectorization instead of using loop

2008-10-09 Thread Patrick Burns
One thing that would speed it up is if you inverted 'covmat' once and then used 'inverted=TRUE' in the call to 'mahalanobis'. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide for the Unwilling S User") Frank Hedler wrote: Dear all, I'v

Re: [R] vectorization instead of using loop

2008-10-09 Thread Richard . Cotton
> I've sent this question 2 days ago and got response from Sarah. Thanks for > that. But unfortunately, it did not really solve our problem. The main issue > is that we want to use our own (manipulated) covariance matrix in the > calculation of the mahalanobis distance. Does anyone know how to v

Re: [R] vectorization instead of using loop

2008-10-09 Thread Richard . Cotton
Frank said: > > This piece of code works, but it is very slow. We were wondering if it's > at > > all possible to somehow vectorize this function. Any help would be > greatly > > appreciated. Richie said: > You can save a substantial time by calling as.matrix before the loop Patrick said: > On