Displaying 1 result from an estimated 1 matches for "tp1399935p1415529".
2010 Jan 28
2
Error on using lag function
Hello everyone, I have a vector P and I want to replace each of its missing
values by its next element, for example:
P[i] = NA --> P[i] = P[i+1]
To do this I am using the replace() and lag() functions like this:
P <- replace(as.ts(P),is.na(as.ts(P)),as.ts(lag(P,1)))
but here is the error that I get:
Warning message:
In NextMethod("[<-") :
number of items to replace is not a