Line in R plot should start at a different timepoint
问题 I have the following example data set: date<-c(1,2,3,4,5,6,7,8) valuex<-c(2,1,2,1,2,3,4,2) valuey<-c(2,3,4,5,6) now I plot the date and the valuex variable: plot(date,valuex,type="l") now, I want to add a line of the valuey variable, but it should start with the 4th day, so not at the beginning, therefore I add NA values: valuexmod<-c(rep(NA,3),valuex) and I add the line with: lines(date,valuexmod,type="l",col="red") But this does not work? R ignores the NA values and the valuexmod line