Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 strptime() 从因子变量中解析日期——但有一个问题。我的日期(错误地)将日期和月份列为单数而不是双数。例如,我的日期会说:5/5/2012 14:02 而不是 05/05/2012 14:02。
因此,当我运行代码时会返回 NA 值:
strptime(var,"%m/%d/%y %H:%M")
有解决办法吗?
资本Y会这样做:
Y
test <- "5/5/2012 14:02" strptime(test,"%m/%d/%Y %H:%M") [1] "2012-05-05 14:02:00"