Re: [R] Speed up R code

2009-11-23 Thread AnnaFowler
Thanks Stephane, Thats a great help! SL-16 wrote: > > Loops tend to dramatically increase computation time. You may re-write > a vectorized version of your code if possible, i.e. use matrix > algebra. Calculus is a lot faster if one can avoid loops (at least > some of them) . > > Best, > Steph

Re: [R] Speed up R code

2009-11-23 Thread SL
Loops tend to dramatically increase computation time. You may re-write a vectorized version of your code if possible, i.e. use matrix algebra. Calculus is a lot faster if one can avoid loops (at least some of them) . Best, Stephane 2009/11/23 AnnaFowler : > > Hi, Im new to R and having some troub

[R] Speed up R code

2009-11-23 Thread AnnaFowler
Hi, Im new to R and having some trouble with my code - it works, its just very slow! Ive tried lots of things, but nothing quite seems to work, so any help and suggestions would be really appreciated! I want to calculate the marginal likelihood for every element of a row of a matrix and the corre