Converting the data in year month day hour and minutes to date in R -
i trying convert date factor date using “as.date” function in r. have date in next format
2008-01-01 02:30 i tried utilize next command :
as.date(mydata$date, format="%y-%m-%d %h:%mm") can help me ? able convert format no hr getting difficulty hr included.
thank you.
your format string wrong :
r> strptime("2008-01-01 02:30", format="%y-%m-%d %h:%m") # [1] "2008-01-01 02:30:00" see ?strptime detailed values can utilize define format.
also note string in standard format, can utilize straight as.posixlt :
r> as.posixlt("2008-01-01 02:30") # [1] "2008-01-01 02:30:00" r
No comments:
Post a Comment