我有一些數據,看起來像這樣:轉換爲日期和剝離時間?
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.