从r中具有lubridate(mdy)的字符指定日期

时间:2018-03-26 15:29:34

标签: r lubridate

我在使用parse_date_time lubridate函数的mdy格式时遇到问题。

# does work
date <- "21 December 2016"
date_text <- parse_date_time(date, "dmy", tz = "UTC")
# does work
date <- "2016 December 21"
date_text <- parse_date_time(date, "ymd", tz = "UTC")
# does work
date <- "2016 21 December"
date_text <- parse_date_time(date, "ydm", tz = "UTC")
# DOES NOT WORK
date <- "December 21 2016"
date_text <- parse_date_time(date, "mdy", tz = "UTC")

任何人都可以告诉我为什么最后一个版本无法工作以及如何使其工作? 我收到了消息:

Warning message:
All formats failed to parse. No formats found. 

0 个答案:

没有答案