Message-ID: <4B621E9F.7060801@ucalgary.ca>
Date: 2010-01-28T23:32:47Z
From: Peter Ehlers
Subject: Error on using lag function
In-Reply-To: <1264718042048-1401319.post@n4.nabble.com>
Did you try it? I said
library(zoo)
na.locf(P, fromLast=TRUE)
Note the 'fromLast=TRUE'; that tells na.locf() to use the
reverse of your vector.
What I meant by
"You'll have to decide what to do if the last value is NA"
is that you'll need to decide what to do if your vector
ends with a NA, say:
v
[1] 1 9 NA 4 5 20 NA 15 8 NA
-Peter Ehlers
anna wrote:
> Hi Peter, thank you for helping. The thing is don't want to it replace it
> with the last value but with the next value
>
> -----
> Anna Lippel
--
Peter Ehlers
University of Calgary