I think it's even simpler than that: >> plot(y~as.POSIXct(times, format="%d.%m. %H:%M"), type="l", >> data=na.omit(data.frame(y,times)))
This is using y from the data specification in the plot command (not the y in the base environment, or you'd be getting the same error), and data= is specifying the data with NAs omitted. >> 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")') This command is using input[,2] for its y varialble, which has *not* had the NA values removed. It's a matter of which data your plot() command is using, and it's not what you seem to think it is. Sarah -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ 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.