I have a data.frame
like below where I don't have record for winter months i.e. January, February, November and December. I want to compelete the Date
sequence such that my first Date
start with 2001-01-01
and ends on 2003-12-31
where NA
is provided for the Missing winter months. Any help would be appreciate.
DF <-data.frame(Date = seq(as.Date("2001-01-01"), to = as.Date("2003-12-31"), by = "day"),
Ob = runif(1095,1,5), Sim = runif(1095,1,5)) %>%
filter(between(month(Date),3,10))
Maybe you can try left_join
like below
data.frame(
Date = seq(as.Date("2001-01-01"), to = as.Date("2003-12-31"), by = "day")
) %>%
left_join(DF)