I am in the process of merging two data frames based on date-time, and seem to have run into a snag. The time column in 1 of 2 of the DF's has a timezone stamp:
#Example
"2012-09-28 08:15:00 MDT"
And the other DF time column does not
#Example 2
"2012-09-28 08:15:00"
In my program both of these are POSIXct objects, formatted exactly the same ,besides the timezone stamp. When trying to merge based on the Time columns, NA's appear, b/c they are not recognizing each other.
I have narrowed the problem down to the DF missing the Tz. Something strange is going on. When I have the Data for the datetime Column outside the data frame it reads as such
#Code used to make these values
NewTime<-as.POSIXct(TimeDis$datetime, format="%Y-%m-%d %H:%M")
>NewTime
[1] "2017-08-16 00:00:00 MDT" "2017-08-16 00:15:00 MDT"
[3] "2017-08-16 00:30:00 MDT" "2017-08-16 00:45:00 MDT"
Now when I put this into a data frame with data, the "MDT" does not show up
Discharge_Time<-data.frame(NewTime,DischargeFin)
> Discharge_Time
NewTime DischargeFin
1 2017-08-16 00:00:00 990525.2
2 2017-08-16 00:15:00 990525.2
3 2017-08-16 00:30:00 1000719.2
4 2017-08-16 00:45:00 1000719.2
Even stranger if I call,
>Discharge_Time[1,1]
"2017-08-16 MDT"
I get the MDT back but now no time....
I have no idea what is going on, but am hoping to find a way for the MDT and all the rest to stick around in that data frame so I can successfully merge it with the other DF, which isn't missing anything
Research Done: How to change a time zone in a data frame?