[R] Reporting missing dates

Jeff Reichman re|chm@nj @end|ng |rom @bcg|ob@|@net
Wed Jan 15 22:28:04 CET 2020

R-help Forum

I have a 20 year data set and I am looking for a way to find missing dates.
I wrote this and its works, but am wounding if there is a better way?

d <- c('2020-01-01', '2020-01-02', '2020-01-04', '2020-01-05')
d <- as.Date(d)
date_range <- seq(min(d), max(d), by = 1) 
date_range[!date_range %in% d] 


Jeff Reichman

	[[alternative HTML version deleted]]

More information about the R-help mailing list