The first thing to do is to run Rprof and determine where time is being spent. It may be that it is one of the functions that you are calling inside the loop that is taking the majority of time and if that is the case, there may not be any improvement other than coming up with a different algorithm. 'for' loops themselves are not necessarily that slow; it is usually the case that you may not be preallocating storage, or there are some other things happening. Rprof will help determine where the problem might be.
On Thu, Jun 12, 2008 at 11:52 AM, Rafael Barros de Rezende <[EMAIL PROTECTED]> wrote: > > Dear R users, > > I would like to know if there is a way to increase the for() loop speed > because in my routine the calculations are too slow. > > Best regards. > Rafael Barros de Rezende > Cedeplar - Center for Development and Regional Planning > Face, UFMG ([1]http://www.cedeplar.ufmg.br) > -- > Esta mensagem foi verificada pelo sistema de antivĂrus e > acredita-se estar livre de perigo. > > References > > 1. http://www.cedeplar.ufmg.br/ > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.