Hi Petr Thanks for reply.
On 24 October 2012 07:26, PIKAL Petr [via R] < ml-node+s789695n464726...@n4.nabble.com> wrote: > Hi > > It is a piece of my code. At this, i create a matrix(deltab) with each column is a binomial, but in there are several NAs, and i must restart the cycle the number of Nas is zero. So, the problem this process takes a very long time. > > > > 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. > > What is this code supposed to do? It gives an error (see below) > > > 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} > + } > 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 > > > > > > 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. > > > > ______________________________________________ > > [hidden email] > > <http://user/SendEmail.jtp?type=node&node=4647269&i=0>mailing list > > 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. > > ______________________________________________ > [hidden email] <http://user/SendEmail.jtp?type=node&node=4647269&i=1>mailing > list > 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. > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://r.789695.n4.nabble.com/repeat-takes-along-time-tp4647160p4647269.html > To unsubscribe from repeat takes along time, click > here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4647160&code=anBtbWVpc3RlckBnbWFpbC5jb218NDY0NzE2MHwxODQ1OTAyNw==> > . > NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- *Jorge Mendonça* -- View this message in context: http://r.789695.n4.nabble.com/repeat-takes-along-time-tp4647160p4647285.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list 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.