On Jul 27, 2010, at 6:44 PM, jd6688 wrote:


I am trying to do the following to accomplish the tasks, can anybody to
simplify the solutions.

Thanks,

for (i in 1:10000){
d<-apply(s,2,sample)
 pos_neg_tem<-t(apply(d,1,doit))
if (i>1){
  pos_neg_pool<-rbind(pos_neg_pool,pos_neg_tem)

}else{

 pos_neg_pool<- pos_neg_tem
}}

A bit of efficiency advice: incremental creation of objects is generally a major source of slowness. Consider creating pos_neg_pool before the loop and then "filling it in" within the loop. It would also let you remove that "if{}else{}" statement.

--

David Winsemius, MD
West Hartford, CT

______________________________________________
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.

Reply via email to