z <- zoo(c(2,NA,1,4,5,2), c(1,3,4,6,7,8))
## use underlying time scale for interpolation
na.approx(z)
## use equidistant spacing
na.approx(z, 1:6)
# with and without na.rm = FALSE
zz <- c(NA,9,3,NA,3,2)
na.approx(zz, na.rm = FALSE)
na.approx(zz)
Run the code above in your browser using DataLab