Converting a character string into a date in R -
the data i'm trying convert supposed date, formatted mmddyyyy no separation dashes or slashes. in order work dates in r, have formatted mm-dd-yyyy or mm/dd/yyyy.
i think might need use grep()
, i'm not sure how use reformat of dates in mmddyyyy format.
have @ lubridate
mdy
function
require(lubridate) <- "10281994" mdy(a)
gives
[1] "1994-10-28 utc"
of class "posixct" "posixt"
datetime in r. (thanks joshua ulrich correction)
you use as.date(mdy(a))
= 1994-10-28
object of class date
.
there mutations ymd
, dmy
within lubridate
well.
Comments
Post a Comment