继续收到此警告消息:
Warning message: In .parse_hms(..., order = "HMS", quiet = quiet) : Some strings failed to parse, or all strings are NAs
该函数将我的角色向量中的所有数据替换为NA
。
我试过通过hms()
包运行lubridate
函数并再次尝试使用POSIXct
combined$start<- c("8:45" "12:10" "16:00")
combined$start <- as.character(combined$start)
combined$start <- hms(combined$start)
我想将combined$start
中的字符转换为hms
,但是当我尝试运行最后一行代码时,我只得到NA
。
你在combined$start
没有任何秒数,所以试试用hm。
combined$start <- hm(combined$start)
我还注意到在创建combined$start
时没有逗号,所以请尝试将行更改为:
combined$start<- c("8:45", "12:10", "16:00")