See na.locf in the zoo package. It does exactly that.
On Thu, Nov 13, 2008 at 12:07 PM, ravi <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a vector where an integer is followed by a randomly varying number of
> NA elements. I want to replace the NA's with the preceding integer. Let me
> explain wit
Hi,
I have a vector where an integer is followed by a randomly varying number of NA
elements. I want to replace the NA's with the preceding integer. Let me explain
with a simple example :
avec<- c(1,NA,NA,5,NA,3,4,NA,NA,NA,NA,9,NA,0,NA,NA)
I want to get the following vector from a :
bvec<-c(1,1,1
2 matches
Mail list logo