【发布时间】:2014-05-05 12:27:22
【问题描述】:
我正在尝试从 csv 文件中的日期变量中识别周数。 大多数列值都有正确分配的日期,例如“2006-03-23 11:11:22” 由 R 正确解释:
> strftime(as.POSIXlt("2006-03-23 11:11:22"), format="%W")
[1] "12"
但是,某些值被分配了 0 值 - 即“0000-00-00 00:00:00”,这些值被错误地解释。
> strftime(as.POSIXlt("0000-00-00 00:00:00"), format="%W")
Error in as.POSIXlt.character("0000-00-00 00:00:00") :
character string is not in a standard unambiguous format
我可以用我的 csv 文件做什么来修复它?文件很大,我需要高效
【问题讨论】:
-
你想用 0000-00-00 00:00:00 日期做什么?被排除在外了吗?设置为 0?