Re: [R] Speeding things up

2007-01-08 Thread Zoltan Kmetty
Hi Benjamin! ##TRY THIS: THIS MAYBE MUCH FASTER, BECAUSE ONLY WORK WITH THE IMPORTANAT ROWS - HOPE NO ERROR IN IT:D puffer1 <- as.matrix(sdata$value) puffer2 <- rbind(as.matrix(puffer1[2:nrow(puffer1),1]),0) speedy <- puffer1 > puffer2 speedy <- (as.matrix(which(puffer1==TRUE)))+1 sdata$ddtd[]=

Re: [R] Speeding things up

2007-01-08 Thread Benjamin Dickgiesser
Thanks for your answers, your help is highly appreciated! On 1/8/07, Zoltan Kmetty <[EMAIL PROTECTED]> wrote: > Hi Benjamin! > > > ##TRY THIS: THIS MAYBE MUCH FASTER, BECAUSE ONLY WORK WITH THE IMPORTANAT > ROWS - HOPE NO ERROR IN IT:D > > puffer1 <- as.matrix(sdata$value) > puffer2 <- rbind(as.ma

Re: [R] Speeding things up

2007-01-08 Thread Henrik Bengtsson
First, since you only update the 'ddtd' conditioned on 'value', you should be able to vectorize removing the loop. I let you figure out how to do that yourself. Second, you apply the "$" operator multiple times in the loop that will definitely add some overhead. It should be faster to extract 'v

[R] Speeding things up

2007-01-08 Thread Benjamin Dickgiesser
Hi, is it possible to do this operation faster? I am going over 35k data entries and this takes quite some time. for(cnt in 2:length(sdata$date)) { if(sdata$value[cnt] < sdata$value[cnt - 1]) { sdata$ddtd[cnt] <- sdata$ddtd[cnt - 1] +