[R] For Loops please help!!

Dan D ddalthorp at usgs.gov
Sat Sep 5 18:31:40 CEST 2015

Yes, the cause is memory use patterns, but the price is steep nonetheless.


rate<-log(400*1.1^(1:30)) # runs about 27x times as fast as the following
(test via 'microbenchmark') 

for (i in 1:30){

When manipulating large arrays, the difference can easily be a few seconds
vs. an hour or more. And if many such arrays need to be run, the difference
is between "difficult" and "not feasible". 


View this message in context: http://r.789695.n4.nabble.com/For-Loops-please-help-tp4711882p4711887.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list