【发布时间】:2017-09-19 14:38:40
【问题描述】:
下面是我试图将 csv 文件转换为 xts 的代码,以便我可以对其进行分析,但似乎没有任何效果。我什至使用了已在此平台上发布的类似问题的答案,但似乎没有任何效果。
toDate <- function(x) as.Date(x, origin = "2015-02-15")
z <- read.zoo("Nasdaq.csv", header = TRUE, sep = ",", FUN = toDate)
x <- as.xts(z)
我得到以下错误:
7. stop("character string is not in a standard unambiguous format")
6. charToDate(x)
5. as.Date.character(x, origin = "2015-02-15")
4. as.Date(x, origin = "2015-02-15")
3. FUN(...)
2. processFUN(ix)
1. read.zoo("Nasdaq.csv", header = TRUE, sep = ",", FUN = toDate)
【问题讨论】:
-
如果您发布 dput(z) 的输出,其他人将能够复制您的问题,这将有助于回答问题。
-
错误信息似乎很清楚——文件中的日期不是标准格式。您将需要提供一种格式,以便它知道如何解释它们。如果没有可重现的示例(缺少输入的 csv 文件),就不能多说。请查看minimal reproducible example。