如何读取R中的大型数据集

Nik*_*lin 4 r large-data

可能重复:
快速读取非常大的表作为R中的数据帧

嗨,

尝试读取R中的大型数据集,控制台显示以下错误:

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)
Run Code Online (Sandbox Code Playgroud)

有谁知道如何阅读大型数据集?UserDailyStats.csv的大小约为2GB.

Dir*_*tel 13

当然:

  1. 获得更大的计算机,尤其是更多的计算机
  2. 运行64位操作系统,请参阅1)关于更多ram,现在您可以使用它
  3. 只读您需要的列
  4. 阅读更少的行
  5. 以二进制方式读取数据而不是重新解析2gb(这是非常低效的).

还有一本手册[R站点.