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.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to