I have the following data (sample) with some leap minutes (e.g. 6:32 and 6:33 are missing). For those cases, count equals 0 but the database just didn't report them and leaps the minutes.
count time
47 15/12/2014 06:30
3 15/12/2014 06:31
431 15/12/2014 06:34
320 15/12/2014 06:35
42 15/12/2014 06:36
13 15/12/2014 06:37
383 15/12/2014 06:38
160 15/12/2014 06:39
I have tried to follow other posts (I,II,III) where they used the xts package
but it didn't work. I tried my own approach but it didn't work either:
sort.df <- df[order(df$time),]
time.min <- min(sort.df$time)
time.max <- max(sort.df$time)
all.dates <- seq(time.min, time.max, by="min") # I create a list of all the minutes.
all.dates.frame <- data.frame(list(time=all.dates))
merged.data <- merge(all.dates.frame, sorted.data, all=T)
All I get is all the minutes duplicated with NA values. Anyone know what I am doing wrong? Any help/ideas hugely appreciated!