Re: [R] how to connect dots by passing NA

2008-04-17 Thread Gabor Grothendieck
Also, here is a similar solution, even more compact, not involving zoo: plot(y ~ x, na.omit(data.frame(x, y)), lty = 3, type = "l") lines(y ~ x) On Wed, Apr 16, 2008 at 11:18 PM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Try this which interpolates the NAs using na.approx from zoo > drawing

Re: [R] how to connect dots by passing NA

2008-04-16 Thread Gabor Grothendieck
Try this which interpolates the NAs using na.approx from zoo drawing the interpolated series with lty=3 and then overwrites solid lines with the gaps using lines. library(zoo) plot(y ~ x, as.data.frame(na.approx(zoo(cbind(x, y, lty = 3, type = "l") lines(y ~ x) On Wed, Apr 16, 2008 at 8:56 P

Re: [R] how to connect dots by passing NA

2008-04-16 Thread Rolf Turner
On 17/04/2008, at 12:56 PM, DinoDragon wrote: > This maybe a silly question. I'm trying to figure out a way to draw > a line from a data set which contain NA. Say, I have a set of data as: > > x <- c(1.1 2.2 NA 4.4 5.5) ; y <- c(1:5) # as x,y of point a, b, > c, d, and e. > > I would like to

[R] how to connect dots by passing NA

2008-04-16 Thread DinoDragon
This maybe a silly question. I'm trying to figure out a way to draw a line from a data set which contain NA. Say, I have a set of data as: x <- c(1.1 2.2 NA 4.4 5.5) ; y <- c(1:5) # as x,y of point a, b, c, d, and e. I would like to plot this to a line by using dot-line to connect the two adjac