Description Usage Arguments Details Value Examples
Function to complete a time-indexed series (either ts
or zoo
) by combining it with another series to avoid NAs. The function has a third argument "fill" to chose whether to leave NA, interpolate or repeate the last value when both vectors are missing.
1 | tsComplete(x, y, fill = "fill")
|
x |
main data series (either |
y |
secondary series (either |
fill |
method to treat NA's after combining |
Supports both ts
and zoo
. Converts to zoo
if one of the parameters is zoo
.
Returns either a ts
(default) or zoo
object.
1 2 3 4 5 6 7 8 9 10 | a <- c(NA, 1, 2,NA,NA, 5,NA)
b <- c( NA,12,NA,13,NA,15,16)
a2 <- ts(a,start=c(2000,1),freq=4)
b2 <- ts(b,start=c(2000,2),freq=4)
b3 <- zoo::as.zoo(b2)
aa <- tsComplete(a2)
ab1 <- tsComplete(a2,b2)
ab2 <- tsComplete(a2,b2,fill="na")
ab3 <- tsComplete(a2,b3)
ab4 <- tsComplete(a2,b3,fill="fill")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.