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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -