r - How can I change `as.POSIXct` into useful format? -


i have following data, , format date/time datetime format analysis on.

date    vt1 02/05/15 14:00  23.611 02/05/15 15:00  28.61 02/05/15 16:00  28.61 02/05/15 17:00  19.608 

i used following code:

test$betterdate<- as.posixct(substr(test$date,1,14), format = "%d/%m/%y %h:%m") 

and keep getting error:

error in `$<-.data.frame`(`*tmp*`, "betterdate", value = numeric(0)) :    replacement has 0 rows, data has 3836 

i believe issue 2 digit years %y not %y. works

as.posixct("02/05/15 14:00", format = "%d/%m/%y %h:%m") [1] "2015-05-02 14:00:00 art" 

you might want check if timezone correct (argument tz of as.posixct).

good luck.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -