Is it possible to update the origin date of a time, based on the date in another column? I have 2 columns, one with 10 rows of Dates, and the other with 10 rows of Times, which have a date attached to them. I originally converted the time from character using as.POSIX1t
, and tried setting origin=df$Date
, but that did not work. The date just showed up as today's date. How can I reset the origin date of the Time to be the same date as my Date column? Or, is it possible to just remove the Date that is attached to my time, and then create a new column that attaches the Time and Date columns?
My data:
Date Time
1999-05-10 2017-10-25 07:50:00
1999-05-11 2017-10-25 15:30:00
1999-05-12 2017-10-25 18:00:00
1999-05-13 2017-10-25 23:05:00
1999-05-14 2017-10-25 19:30:00
1999-05-15 2017-10-25 19:00:00
1999-05-16 2017-10-25 16:10:00
1999-05-17 2017-10-25 10:00:00
1999-05-18 2017-10-25 02:30:00
1999-05-19 2017-10-25 22:00:00
1999-05-20 2017-10-25 21:50:00
And an str()
of the data:
'data.frame': 11 obs. of 2 variables:
$ Date: Date, format: "1999-05-10" "1999-05-11" "1999-05-12" "1999-05-13" ...
$ Time: POSIXlt, format: "2017-10-25 07:50:00" "2017-10-25 15:30:00" "2017-10-25 18:00:00" "2017-10-25 23:05:00" ...