I have the following dataframe (DF1):
Date Value
29/12/2014 8:00 24.940
29/12/2014 9:00 24.960
29/12/2014 11:00 25.020
I would like to add a new column for DF1$DIFF, where it contains the difference in values between each line's Date (including hours) to its above Date. So that the required results will be:
Date Value Diff
29/12/2014 8:00 24.940
29/12/2014 9:00 24.960 1
29/12/2014 11:00 25.020 2
I tried to use the as.date function, however, I get the difference in dates only:
> as.Date("2009-10-01 10:00")- as.Date("2009-10-01 9:00")
Time difference of 0 days