Re: [R] How to increase the for() loop speed?

From: jim holtman <jholtman_at_gmail.com>
Date: Thu, 12 Jun 2008 14:20:48 -0400

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 <rafabarros_at_cedeplar.ufmg.br> 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_at_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_at_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.
Received on Thu 12 Jun 2008 - 20:52:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 12 Jun 2008 - 21:31:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive