Hello I have a data frame, called input, like this:
DateTime CO2_A1cont 1 2011-04-08 11:47:01 NA 2 2011-04-08 12:42:01 8.90000 3 2011-04-08 13:07:01 NA 4 2011-04-08 13:32:01 NA 5 2011-04-08 13:57:01 7.556482 6 2011-04-08 14:22:01 NA .... 57 2011-04-09 16:52:01 4.961558 And like to plot this series with plot() and connected lines, no interruption by the NAs. I found that this code works: y<-input[,2] times <- DateTime plot(y~as.POSIXct(times, format="%d.%m. %H:%M"), type="l", data=na.omit(data.frame(y,times))) whereas this plot command... plot(input[,2]~as.POSIXct(DateTime, format="%d.%m. %H:%M"), type="l", data=na.omit(data.frame(input[,2],DateTime))) ... produces the error: Error in model.frame.default(formula = input[, 2] ~ as.POSIXct(DateTime, : variable lengths differ (found for 'as.POSIXct(DateTime, format = "%d.%m. %H:%M")') I already checked the length of y, times, input[,2], DateTime, as.POSIXct(DateTime, format="%d.%m. %H:%M") which give all 57! nrow(data.frame(input[,2],DateTime)) and nrow(data.frame(y,times)) give both 57! Too. Thanks for any help. Best regards Raphael [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.