[R] re-sampling of large sacle data

David Winsemius dwinsemius at comcast.net
Wed Jul 28 13:22:06 CEST 2010


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



More information about the R-help mailing list