【发布时间】:2011-07-21 08:55:24
【问题描述】:
我有一个因子向量 x 看起来像这样:
""
"1992-02-13"
"2011-03-10"
""
"1998-11-30"
我可以将此向量转换为日期向量(使用as.Date())吗?
尝试显而易见的方法给了我:
> x <- as.Date(x)
Error in charToDate(x) :
character string is not in a standard unambiguous format
目前我这样解决这个问题:
> levels(x)[1] <- NA
> x <- as.Date(x)
但这看起来不太优雅......
提前谢谢你!
【问题讨论】: