[R] Mixed format

David Luckett dj|uckett @end|ng |rom gm@||@com
Wed Jan 22 05:36:54 CET 2020


Bearing Peter's warning in mind, the {anytime} package can be useful in this
example:

library(anytime)
DFX$dnew <- anydate(DFX$ddate)
DFX
# First three strings are ambiguous
# Also, string 5 is only OK if its assumed to be the same format as
strings 4 & 6.

# Can add a specific format to those anytime() uses:
getFormats()
addFormats(c("%d-%m-%y"))

DFX$dnew <- anydate(DFX$ddate)
DFX

Cheers
David Luckett
djluckett using gmail.com
0408 750 703



More information about the R-help mailing list