I'm trying to learn R, and I'm stuck with a problem regarding the conversion of one column in a data set from integer values to time.
The aforementioned column breaks the days in 5 minute portions. Using the following format: 5 would be 00:05, 105 would be 01:05 and 1105 would be 11:05.
if I use:
strptime(activity[,"interval"],format="%H%M")
The resulting object returns "NA" for all the values that are below 1000.
Any ideas on how to make that same process using apply family would be greatly appreciated
I know this is a pretty basic question but I am not able to figure it out myself.
Thank you very much
Edit: As requested the activity[n,"interval"] column (This column has 17568 rows, comprising numbers from 5 to 2355 for several days) and the 15 first elements look like this:
activity[1:15,"interval"]
[1] 0 5 10 15 20 25 30 35 40 45 50 55 100 105 110
And should look like this
activity[1:15,"interval"]
[1] 0000 0005 0010 0015 0020 0025 0030 0035 0040 0045
[11] 0050 0055 0100 0105 0110
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…