可能重複:
Quickly reading very large tables as dataframes in R如何在R讀取大型數據集
嗨,
試圖讀取大型數據集R中控制檯顯示的follwing錯誤:
data<-read.csv("UserDailyStats.csv", sep=",", header=T, na.strings="-", stringsAsFactors=FALSE)
> data = data[complete.cases(data),]
> dataset<-data.frame(user_id=as.character(data[,1]),event_date= as.character(data[,2]),day_of_week=as.factor(data[,3]),distinct_events_a_count=as.numeric(as.character(data[,4])),total_events_a_count=as.numeric(as.character(data[,5])),events_a_duration=as.numeric(as.character(data[,6])),distinct_events_b_count=as.numeric(as.character(data[,7])),total_events_b=as.numeric(as.character(data[,8])),events_b_duration= as.numeric(as.character(data[,9])))
Error: cannot allocate vector of size 94.3 Mb
In addition: Warning messages:
1: In data.frame(user_msisdn = as.character(data[, 1]), calls_date = as.character(data[, :
NAs introduced by coercion
2: In data.frame(user_msisdn = as.character(data[, 1]), calls_date = as.character(data[, :
NAs introduced by coercion
3: In class(value) <- "data.frame" :
Reached total allocation of 3583Mb: see help(memory.size)
4: In class(value) <- "data.frame" :
Reached total allocation of 3583Mb: see help(memory.size)
有誰知道如何閱讀大型數據集? UserDailyStats.csv的大小約爲2GB。
相關:http://stackoverflow.com/questions/1875795/best-practices-for-storing-and-using-data-frames-too-large-for-memory和http://stackoverflow.com/questions/3340568 /設置大數據庫在mysql-for-analysis-in-r – 2010-10-19 12:21:42
另請參閱:http://yusung.blogspot.com/2007/09/dealing-with-large-data-set- in-r.html和http://ff.r-forge.r-project.org/bit&ff2.1-2_WU_Vienna2010.pdf – 2010-10-19 12:22:25