[R] Iterative loop using "repeat"

mary mary.dama at libero.it
Sun Jan 6 11:53:45 CET 2013


Hi Jim,
The last question:
I changed my function robustm ()  to have as output the scatter matrix and
the data to re-enter into the process and I used as suggested you  "while
do", and seems to work without errors.

iterate.robustm<-function(x,z) { 
b<-robustm(x,z)                                     #in robustm() the output
is a list with [[1]]=scatter matrix  [[2]]=my new data
bS<-b[[1]] 
finido<-FALSE 
while(!finido) {      
 b2<-robustm(b[[1]],b[[2]])
bS2<-b2[[1]]
   for(i in 1:10) 
for(j in 1:10)
    if(abs(bS2[i,j]-bS[i,j])<=0.001) finido<-TRUE 
   b<-b2
  } 
  return(b) 
}

But my question now is what is the difference between the recursive process
"while do" and suggested earlier with "if else"?

Thank you for all precious tips suggested me
Mary



--
View this message in context: http://r.789695.n4.nabble.com/Iterative-loop-using-repeat-tp4654625p4654777.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list