parse_date_time returns NA 的向量
parse_date_time returns a vector of NA
我正在尝试将一个大列从因子转换为日期时间值。
我收到以下错误
parse_date_time(Data,"Ymd H")
#[1] NA
Warning message:
All formats failed to parse. No formats found.
table 中的字符串结构为
Oct 22 18:50:08 2012
您可以在 base R 中执行此操作,但问题在于阅读 ?strptime
以了解要使用的格式。
as.POSIXct("Oct 22 18:50:08 2012", format = "%b %d %T %Y", tz = "UTC")
#[1] "2012-10-22 18:50:08 UTC"
如果你想使用parse_date_time
你可以使用
lubridate::parse_date_time("Oct 22 18:50:08 2012","mdTY")
#[1] "2012-10-22 18:50:08 UTC"
我们可以使用 anytime
来自 anytime
library(anytime)
anytime("Oct 22 18:50:08 2012")
#[1] "2012-10-22 18:50:08 EDT"
我正在尝试将一个大列从因子转换为日期时间值。
我收到以下错误
parse_date_time(Data,"Ymd H")
#[1] NA
Warning message: All formats failed to parse. No formats found.
table 中的字符串结构为
Oct 22 18:50:08 2012
您可以在 base R 中执行此操作,但问题在于阅读 ?strptime
以了解要使用的格式。
as.POSIXct("Oct 22 18:50:08 2012", format = "%b %d %T %Y", tz = "UTC")
#[1] "2012-10-22 18:50:08 UTC"
如果你想使用parse_date_time
你可以使用
lubridate::parse_date_time("Oct 22 18:50:08 2012","mdTY")
#[1] "2012-10-22 18:50:08 UTC"
我们可以使用 anytime
来自 anytime
library(anytime)
anytime("Oct 22 18:50:08 2012")
#[1] "2012-10-22 18:50:08 EDT"