【发布时间】:2012-07-08 18:15:00
【问题描述】:
我正在尝试编写一个函数,它将一些 xts 数据加载到 R 中,并按我指定的日期/时间对它们进行排序。也许我正在尝试一种过于简单的方法,但这是我的代码:
load.data <- function (x, time1, time2) #x is going to be the actual file name
{
vector = get(load("C:/Users/username/Desktop/x"))
sortvector = vector['time1/time2/']
return (sortvector)
}
当我执行它时,我得到了消息:
In readChar(con, 5L, useBytes = TRUE) :
cannot open compressed file 'C:/Users/username/Desktop/x', probable reason 'No such file or directory'
那么,我怎样才能让我的函数真正搜索文件名,而不是实际的通用“x”?我希望我很清楚,我当然会非常感谢任何帮助。
【问题讨论】:
-
我不确定你想要
sortvector是什么。看?'[.xts'。