[R] help with executing instruction every i-th run of loop

Mark W Kimpel mwkimpel at gmail.com
Thu May 17 16:56:51 CEST 2007

I am running a very long loop and would like to save intermediate 
results in case of a system or program crash. Here is the skeleton of 
what my code would be:

for (i in 1:zillion)
    if (logical.test(i)) {save(results, "results.tmp")}

logical.test would test to see if i/1000 has no remainder. What R 
function would test that?

Is there an even better way to address my need?



Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
Indiana University School of Medicine

15032 Hunter Court, Westfield, IN  46074

(317) 490-5129 Work, & Mobile & VoiceMail
(317) 663-0513 Home (no voice mail please)

More information about the R-help mailing list