Skip to content

plotting time series with data gap using type line- but do not want to connect gap with line

2 messages · Josef.Kardos at phila.gov, Gabor Grothendieck

#
Just place a point with an NA value between the two segments.
Here is one way to do it in zoo:

set.seed(123)
library(zoo)

# create sample data
tt <- c(1:1000, 1200:2000)
z <- zoo(rnorm(length(tt)), tt)

# this will fill in omitted values with NAs
z <- as.zoo(as.ts(z))

plot(z)
On Thu, May 28, 2009 at 3:05 PM, <Josef.Kardos at phila.gov> wrote: