Dear all, I am trying to identify the days absent in a vector so as to be able to display missing data in the graphics in .It should be done automatically since the graphics will be generated for different periods of the year. I have been trying to do a function below but it did not work. I really appreciate any help
ordados <- function(datas,var) { ind <- !datas %in% var # find the missing date in var miss <- datas[ind] mat <- matrix(NA,length(miss),length(miss)) #insert NA in the missing date mat[,1]<-miss jundado <- rbind (mat,var) jundado <- jundado[order(jundado[,1]),] # sort by dates } For instance: If I have the vector below: 2009-12-01 26.8 2009-12-03 27.9 2009-12-04 25.6 2009-12-05 20.8 2009-12-08 20.8 I will need a result like this one 2009-12-01 26.8 2009-12-02 NA 2009-12-03 27.9 2009-12-04 25.6 2009-12-05 20.8 2009-12-06 NA 2009-12-07 NA 2009-12-08 20.8 Bye and Best Regards Nilza Barros [[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.