Takes any date(times) column and transforms it into a character column, sampling from any number of random of valid character representations.
Arguments
- data
input dataframe
- cols
set of columns to apply transformation to. If
NULL
will apply to all POSIXt columns (formessy_datetime_formats()
) or Date columns (formessy_date_formats()
).- formats
A vector of any number of valid
strptime()
formats. Multiple formats will be sampled at random.
See also
Other Messy date(time) functions:
messy_datetime_tzones()
,
split_datetimes()
Examples
data <- data.frame(dates = rep(Sys.Date(), 10))
messy_date_formats(data)
#> dates
#> 1 03/12/2024
#> 2 2024/12/03
#> 3 2024/12/03
#> 4 2024/12/03
#> 5 2024/12/03
#> 6 2024/12/03
#> 7 2024/12/03
#> 8 2024/12/03
#> 9 03/12/2024
#> 10 2024/12/03