Hi
r-help-bounces at 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]=D$x[i-1]
> }
>
> The data frame is quite large in size ~ 43000 rows. This operation is
taking a> large amount of time. Can someone please suggest me what might be the
reason.
Bad programming practice? I would suggest to use zoo package and na.locf
function after changing all zero values to NA.
Regards
Petr
>
> Thanks
> Regards
> Siddharth
> Sent on my BlackBerry? from Vodafone
> ______________________________________________
> R-help at 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.