Hi Team
I collected some data (see attached) using kobotool box platform, while mutating the start variable which is a date and time variable that came in as character to date. I noticed that the time changed significantly. I used the ymd_hms() function.
See below output for the first 6 observation. Start time before applying the ymd_hms() function is 08:44:52, then, 08:52:52, 09:02:09 .....
After mutating 05:44:52, 05:52:52, 09:02:09 .....
What could be the problem?
datetime_data.pdf (21.9 KB)
Before Mutating
start
1 2025-02-25T08:44:52.976+03:00
2 2025-02-25T08:52:52.535+03:00
3 2025-02-25T09:02:09.595+03:00
4 2025-02-25T09:02:54.823+03:00
5 2025-02-25T09:11:27.205+03:00
6 2025-02-25T09:03:27.331+03:00
After Mutating
trio %>% #Two
- mutate(
-
start = ymd_hms(start)
-
) %>%
- select(start) %>%
- head()
start
1 2025-02-25 05:44:52
2 2025-02-25 05:52:52
3 2025-02-25 06:02:09
4 2025-02-25 06:02:54
5 2025-02-25 06:11:27
6 2025-02-25 06:03:27