I have the following data:
datePickup dateAccepted
1 2015-06-30 14:30:28 2015-06-30 14:32:14
3 2015-07-03 21:25:14 2015-07-03 21:28:50
5 2015-07-03 12:27:30 2015-07-03 12:29:53
and would like to aggregate and average the time difference for each day:
date averageTimeDifferenceInSeconds
1 2015-06-30 106
3 2015-07-03 179.5
I have tried the following as shown on this question calculating time difference in R:
dates <- strptime( paste(df_timestamps[,0], df_timestamps[,1]), "%Y-%m-%d %H:%M:%S")
dates <- as.numeric(difftime(strptime(paste(dates[,1],"%Y-%m-%d %H:%M:%S"),strptime(paste(dates[,2]),"%Y-%m-%d %H:%M:%S"))))
But am getting the error:
Error in lapply(X = x, FUN = "[", ..., drop = drop) :
argument is missing, with no default