how to remove last 3 letters from string including spaces in r -


this question has answer here:

i have following dataframe in r

  date                    count      2016-12-30 17:25:00      34   2016-12-04 10:25:00      31 

i want change format following , want remove seconds date

desired dataframe be

  date                 count   30-12-2016 17:25     34   04-12-2016 10:25     31 

i doing following because of space inbetween date returning me wrong output

 substr(df$date,1,nchar(df$date)-3) 

how can in r?

we convert posixct , format

df1$date <- format(as.posixct(df1$date), "%d-%m-%y %h:%m") df1$date #[1] "30-12-2016 17:25" "04-12-2016 10:25" 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -