sometimes when I use google apis
in R
some dates are ommited when there is no interaction
I would like report them as NAs
. For that purpose I would like to combine a predefined date range 2015-02-13 - 2015-02-16
for example, after the query is used. For example:
range df
dates dates A
2015-02-13 2015-02-13 4
2015-02-14 2015-02-14 3
2015-02-15 2015-02-16 5
2015-02-16
required output:
dates A
2015-02-13 4
2015-02-14 3
2015-02-15 NA
2015-02-16 5
Data:
A <- c(4,3,5)
dates <- as.Date(as.character(c("2015-02-13","2015-02-14","2015-02-16")))
df<-data.frame(dates,A)
range<- seq(as.Date("2015-02-13"), as.Date("2015-02-16"), by = "days")
test<-rbind(range,df)
library(plyr)
test<-rbind.fill(range,df)
But that doesnt do the trick.