Help with group-by function

Please post a Reproducible Example with a small example of your data and the actual code you are using to transform the characters into dates.

If I use the ymd_hms() function from the lubridate package, it handles AM and PM correctly.

library(lubridate)
#> 
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:base':
#> 
#>     date
x <- c("2019-12-01 03:34:00 AM", "2019-12-01 04:14:31 PM")
ymd_hms(x)
#> [1] "2019-12-01 03:34:00 UTC" "2019-12-01 16:14:31 UTC"

Created on 2019-12-01 by the reprex package (v0.3.0.9000)

2 Likes