Skip to content
Prev 165614 / 398506 Next

Line graphs with NA

Try this.  na.approx fills in missing values.  See
?na.approx, ?approx and ?plot.zoo and the
three zoo vignettes.

Lines <- 'Subject:     1      2      3      4
"1"            NA    3      2     NA
"2"            4    NA    NA     4
"3"            6    6.5     6     5.5
"4"            7    NA     NA    7
"5"           NA    8     7.5    NA'
DF <- read.table(textConnection(Lines), header = TRUE)

library(zoo)
z <- zoo(as.matrix(DF[-1]))
plot(na.approx(z, rule = 2), screen = 1, type = "o", pch = 20)
On Sun, Dec 28, 2008 at 1:39 PM, Chris Poliquin <poliquin at sas.upenn.edu> wrote: