r - Why can't lubridate convert dates in a tbl_df? -


i have variable named x this:

x <- structure(list(time = c("2002-05-07 21:00", "2002-05-08 21:00",                               "2002-05-09 21:00", "2002-05-10 21:00",                               "2002-05-11 21:00", "2002-05-13 21:00",                               "2002-05-14 21:00", "2002-05-15 21:00",                              "2002-05-16 21:00", "2002-05-17 21:00")),                 .names = "time", class = c("tbl_df", "data.frame"),                 row.names = c(na, -10l)) 

now, i'd convert strings in x dates , since x[1,1] %>% lubridate::ymd_hm() gives me expected result single element, thought following trick:

x %>% lubridate::ymd_hm() 

but not work (result na) , following warning:

    warning message:     formats failed parse. no formats found. 

why doesn't x %>% lubridate::ymd_hm() work way had expected , can result want?

the function mutate works.

x %>% mutate(time = ymd_hm(time)) 

Comments