Skip to content

Instantly share code, notes, and snippets.

@brshallo
Created May 9, 2022 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brshallo/b8db34e172bcbd37a6db08d099abcc1f to your computer and use it in GitHub Desktop.
Save brshallo/b8db34e172bcbd37a6db08d099abcc1f to your computer and use it in GitHub Desktop.
library(dplyr)
library(lubridate)

tibble(
  file = c("a", "b", "b", "a"),
  dates = c("2020-01-01", "01-jan-2020", "15-mar-2020", "2020-03-15")
) %>%
  mutate(dates_clean = parse_date_time(dates, orders = c("ymd", "dmy")))
#> # A tibble: 4 x 3
#>   file  dates       dates_clean        
#>   <chr> <chr>       <dttm>             
#> 1 a     2020-01-01  2020-01-01 00:00:00
#> 2 b     01-jan-2020 2020-01-01 00:00:00
#> 3 b     15-mar-2020 2020-03-15 00:00:00
#> 4 a     2020-03-15  2020-03-15 00:00:00

Created on 2022-05-09 by the reprex package (v2.0.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment