Skip to content
Prev 119290 / 398498 Next

align() function missing in R ?

On 6/29/07, Markus Loecher <markus at insightfromdata.com> wrote:
Here it is using zoo series:


library(zoo)
x <- c(0.5, 0.2, 0.3, 0.4, 0.3, 0.2, 0.3)

x1 <- zoo(x, c(1, 2, 5, 8, 9, 12, 14))
as.zoo(as.ts(x1))

x2 <- zooreg(1:10, frequency = 4)
frequency(x2) <- 8
x2

x3 <- zoo(x,  c(1, 2.5, 3.2, 4.1, 5.7, 6.5, 7.3))
tt <- 1:7
zoo(approx(time(x3), x3, tt)$y, tt)
# or
tt <- as.numeric(1:7) # can omit if warning in next line ok
window(na.approx(cbind(x3, zoo(, tt))), tt)

For more on zoo:

library(zoo)
vignette("zoo")