【发布时间】:2019-09-23 07:54:00
【问题描述】:
我需要拆分10/4/2018 19:21
并尝试过
AccidentsMp$Hours <- format(as.POSIXct(AccidentsMp$Job.Date, "%Y-%m-%d %H:%M:%S", tz = ""), format = "%H:%M")
AccidentsMp$Dates <- format(as.Date(AccidentsMp$Job.Date,"%Y-%m-%d"), format = "%d/%m/%Y")
我怎样才能把上面的日期和时间分成两列?数据现在是factor类。
【问题讨论】:
-
你能提供
dput(head(your_data_set,10))的输出吗? -
重复“在 R 中数据框的不同列中分割日期和时间”(stackoverflow.com/questions/44320749/…)