formatting dates with R and as.date -
i'm trying format dates r. can explain why r gives error when these 2 strings exact same format? cannot figure out how manage these date strings, , appreciated i'm new working r.
> as.date("09/18/2016 1:00 pm edt") error in chartodate(x) : character string not in standard unambiguous format > as.date("09/08/2016 8:30 pm edt") [1] "0009-08-20" bad <- as.date("09/18/2016 1:00 pm edt") <- as.date("09/08/2016 8:30 pm edt")
you missed fact (and warning) non-standard format needs format string as.date()
. , want strptime()
if want parse hours/minutes etc:
r> strptime("09/18/2016 1:00 pm edt", "%m/%d/%y %i:%m %p") [1] "2016-09-18 13:00:00 cdt" r>
Comments
Post a Comment