Hi I have a strange behaviour of R:
I have a Dataset with Date, Time and some Values:
Date Time Global_active_power
2006-12-16 17:24:00 4.216
2006-12-16 17:25:00 5.360
2006-12-16 18:24:00 6.216
2006-12-16 18:25:00 5.390
2006-12-17 07:24:00 3.216
2006-12-17 17:25:00 1.360
2006-12-17 17:24:00 2.216
2006-12-17 18:25:00 6.360
From the first 2 columns I want to construct a combind column that contains Date+Time in 1 column- something like that:
Date Time Global_active_power combinedTime
2006-12-16 17:24:00 4.216 2006-12-16 17:24:00
The problem now is that in doing so I always get the date of Today mixed into it:
Date Time Global_active_power combinedTime
2006-12-16 17:24:00 4.216 2006-12-16 2017-07-23 17:24:00
This is my code:
Data$Date<- as.Date(Data$Date, "%d/%m/%Y")
Data$Time<-strptime(Data$Time, "%H:%M:%S")
Data1 <-subset(Data, (Date < "2007-02-03" ) )
Data2 <-subset(Data1,(Date > "2007-01-31" ) )
t <- paste((Data2$Date), (Data2$Time))
Data2<-cbind(Data2,t)
In my Time column I have only times. I think my problem comes When I run this line in my code :
Data$Time<-strptime(Data$Time, "%H:%M:%S")
There I suddenly get the date of today plus the time of my column. Why ? I just want the time
Thanks for your help