Well, one way to do it is via regex's -- no splitting and recombining
needed.
Note: This will convert a factor into a character vector.
> z <- c("11/7/2016", "14-07-16")
> z <- gsub("-([[:digit:]]{2})-([[:digit:]]{2})", "/\\1/20\\2",z) ## /\ is
/ and \
> z
[1] "11/7/2016" "14/07/2016"
I leave it
reichm...@sbcglobal.net would like to recall the message, "transforming
dates".
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/pos
R-Help Forum
I have a data set that contains a date field but the dates are in two
formats
11/7/2016dd/mm/
14-07-16 dd-mm-yy
How would I go about correcting this problem. Should I separate the dates,
format them , and then recombine?
Sincerely
Jeff
3 matches
Mail list logo