[R] repeat until function

Ragnhild Sørum rsoerum80 at hotmail.com
Wed Nov 12 15:26:12 CET 2003


I'm in this situation:
I what to generate N random numbers(integer) that are different from each 
One suggestion:

tabel <- rep(NULL, N)
for (i in 1:N){
   temp <- as.integer(runif(1,1,max))
   if(temp in tabel) {
       repeat (?) (temp <- as.integer(runif(i,i,max)))
       until (?) ((temp in tabel) ==FALSE)
   else{ tabel[i] <- temp}

I can't use repeat/until - don't exist....
Any suggestions?


MSN Messenger http://www.msn.no/messenger Den korteste veien mellom deg og 
dine venner

More information about the R-help mailing list