我环顾四周,似乎不太了解这是怎么回事。我在 Eclipse 中使用 R。我要导入的文件是 700mb,大约有 1500 万行和 6 列。由于我在加载时遇到问题,我已经开始使用该ff
包。
library(ff)
FDF = read.csv.ffdf(file='C:\\Users\\William\\Desktop\\R Data\\GBPUSD.1986.2014.txt', header = FALSE, colClasses=c('factor','factor','numeric','numeric','numeric','numeric'), sep=',')
names(FDF)= c('Date','Time','Open','High','Low','Close')
#names the columns in the ffdf file
dim(FDF)
# produces dimensions of the file
然后我想创建一个 POSIXct 序列,该序列稍后将与导入的文件结合。我试过了;
tm1 = seq(as.POSIXct("1986/12/1 00:00"), as.POSIXct("2014/09/04 23:59"),"mins"))
tm1 = data.frame (DateTime=strftime(tm1,format='%Y.%m.%d %H:%M'))
但是 R 一直在崩溃。然后我测试了这是 RStudio 并看到它们对向量的 where 约束。然而,它确实产生了正确的
dim(tm1)
names(tm1)
所以我回到 Eclipse,认为这与内存分配有关。我尝试了以下方法;
library(ff)
tm1 = as.ffdf(seq(as.POSIXct("1986/12/1 00:00"), as.POSIXct("2014/09/04 23:59"),"mins"))
tm1 = as.ffdf(DateTime=strftime(tm1,format='%Y.%m.%d %H:%M'))
names(tm1) = c('DateTime')
dim(tm1)
names(tm1)
这给出了一个错误
'as.ffdf' 没有适用于类“c('POSIXct', 'POSIXt')”的对象的方法
我似乎无法解决这个问题。然后我尝试...
library(ff)
tm1 = as.ff(seq(as.POSIXct("1986/12/1 00:00"), as.POSIXct("2014/09/04 23:59"),"mins"))
tm1 = as.ff(DateTime=strftime(tm1,format='%Y.%m.%d %H:%M'))
这会产生输出日期,但格式不正确。除此之外,当...
dim(tm1)
names(tm1)
在执行的地方,它们都返回 null。
问题
- 如何以我上面需要的格式生成 POSIXct seq?