Re: [R] Odp: Data frame modification

2010-07-28 Thread Petr PIKAL
Hi why do you insist on loops. R is not C. If you want to use loops use C or similar programming languages. It is almost always better to apply whole object approach. Kind and clever people already programmed it (sometimes in C ). x<-rnorm(20) x[c(10,12,13,17)]<-NA x [1] -1.12423790 0.80641

[R] Odp: Data frame modification

2010-07-28 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 28.07.2010 11:30:48: > Hi > > I am trying to modify a data frame D with lists x and y in such a way that if > a value in x==0 then it should replace that value with the last not zero valuein x. I.e. > > for loop over i{ > if(D$x[i]==0) > D$x[i]