Skip to content

repeat takes along time

3 messages · JPM, PIKAL Petr

JPM
#
Hi 

I want help for "repeat" because it takes a long time

repeat{
for (i in 1:n){
probb[i]=sum(Wc[z[,j]>=yb[i]])
}
deltab[,b]=rbinom(n,1,probb)
if(length(which(is.na(deltab[,b])==T))==0){break}
}

This code works but takes much computation time.

Anyone could help me to find a solution to take a shor time.

Thanks

Jorge



--
View this message in context: http://r.789695.n4.nabble.com/repeat-takes-along-time-tp4647160.html
Sent from the R help mailing list archive at Nabble.com.
#
Hi
What is this code supposed to do? It gives an error (see below)
+ for (i in 1:n){
+ probb[i]=sum(Wc[z[,j]>=yb[i]])
+ }
+ deltab[,b]=rbinom(n,1,probb)
+ if(length(which(is.na(deltab[,b])==T))==0){break}
+ }
Error: object 'n' not found
PLEASE do read the posting guide http://www.R-project.org/posting-
guide.html
and provide commented, minimal, self-contained, reproducible code.

and some data to test the code.

Anyway, this kind of code shall be implemented probably in other language like C+.

Regards
Petr