[R] For Loops please help!!

Dan D
Sat, 05 Sep 2015 15:31:15 -0000

Also, any time you write "for" in R, you pay a steep price in
performance. In
a short, simple loop it may not be noticeable, but in a more challenging
problem it can be a huge issue.

A more efficient way to write your loop would be:
infectrate = 400*1.1^(1:30) # calculation
cbind(1:30,log(infectrate))    # display

-Dan



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