ct.org] On Behalf Of Raghuraman
> Ramachandran
> Sent: Tuesday, July 10, 2012 8:23 AM
> To: r-help@r-project.org
> Subject: [R] Help with vectors and rollapply
>
> Hello
>
> I have a vector a =(-2,0,0,0,1,0,0,3,0,0,-4)
>
> I want to replace all zeros into previous non-zer
...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Raghuraman Ramachandran
> Sent: Tuesday, July 10, 2012 8:23 AM
> To: r-help@r-project.org
> Subject: [R] Help with vectors and rollapply
>
> Hello
>
> I have a vector a =(-2,0,0,0,1,0,0,3,0,0,-4)
>
Hello
I have a vector a =(-2,0,0,0,1,0,0,3,0,0,-4)
I want to replace all zeros into previous non-zero state. So for instance the
above vector should be converted into:
a= (-2,-2,-2,-2,1,1,1,3,3,3,-4)
I tried many things and finally concluded that probably(?) rollapply may be the
best way?
I
3 matches
Mail list logo