成功调用fread
后,如果显示进度至少为TRUE,则会显示诊断Read X rows and y (of z) columns from A GB file in HH:MM:SS
。我有一个函数在循环中有多个fread
调用,我想累积行数,可能还有时间。那可能吗?浏览文档,我看不到fread
返回除数据表/框架之外的任何内容。
谢谢。
Parse <- function(Years, Prefix, OutHeader){
for (Year in Years) {
[Snip unnecessary code]
Filename <- SomeFunctionOf(Years)
P <- fread(FileName, colClasses = ColClasses__P, header = TRUE, select = NeededColumns_P)
Stats <- P[, .(A = sum(A, na.rm = TRUE), CurCount = .N,
B = sum(B), Z = sum(Z > 0, na.rm = TRUE)), by = G]
setkey(Stats, G)
write.csv(Stats, paste0(OutHeader, '_Identifier_', Year, '.csv'), row.names = FALSE)
rm(P, Stats)
gc()
}
}