我有一些数据,看起来像这样:转换为日期和剥离时间?
dates <- structure(c(1L, 2L, 4L, 3L), .Label = c("Sat, 18 Nov 2017 00:00:00 GMT",
"Thu, 16 Nov 2017 00:00:00 GMT", "Tue, 14 Nov 2017 00:00:00 GMT",
"Wed, 15 Nov 2017 00:00:00 GMT"), class = "factor")
我想将其转换为日期格式,而不是它的一个因素。此外,我想剥离00:00:00 GMT,因为它是没有意义的
我试图lubridate
但我有与格式的烦恼:
library(lubridate)
mdy(dates)
Warning message:
All formats failed to parse. No formats found.