I’m new to R, so I’d greatly appreciate any help.
Thank you in advance 🙂
I have two df both with date column as character.
I want to change into datetime so I’m using POSIXct
It worked on one df, but not the other. When I run the code on the second df. it returns NA
#Worked here
hourly_steps <- hourly_steps %>% rename(date= activity_hour) %>% mutate(date=as.POSIXct(date, format= "%m/%d/%Y %I:%M:%S %p", tz=Sys.timezone()))
snap shot of the result
#But not here
hourly_calories <- hourly_calories %>% rename(date=activity_hour) %>% mutate(date=as.POSIXct(date, format= "%m/%d/%Y %I:%M:%S %p", tz=Sys.timezone()))
snap shot of the result
I expected a datetime format as POSIXct, with correct values, but I get NA
Jonathan Franco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.