How to convert a string factor into Date?

前端 未结 5 1056
情话喂你
情话喂你 2021-01-24 17:52

I\'m working with the London crime dataset which contains dates in an integer format. I melted them and now they have become factors.

For example, \"

5条回答
  •  难免孤独
    2021-01-24 18:07

    Using base R we can add the date component using paste0 convert to date object using appropriate format.

    as.Date(paste0("X200801", "01"), format = "X%Y%m%d")
    #[1] "2008-01-01"
    

提交回复
热议问题