1

I've run into a very strange situation when I load a csv file into R Studio. When I try loading a file with ~190k records, only ~8k records show up in my dataframe.

I tried loading the data into R Studio on my Mac and everything works fine. I Googled the issue but wasn't able to find a solution.

Below are the specs of both machines:

PC - R + R Studio: latest version -

RAM: 8GB

MAC - R + R Studio: latest version -

RAM: 16GB

I've also tried various solutions like (quote = "") but this did not resolve the truncation. Perhaps I'm missing something very simple. Any ideas?

4

1 回答 1

3

尝试使用fread比 read.csv 读取大数据更快的函数。在我的带有 R + Rstudio 的机器上,我可以在 4G RAM 下读取大约 3G csv 数据。例如:

library("data.table")
data <- fread("ab.csv", header=TRUE, sep=",", colClasses = "numeric")

顺便说一句,通过以下命令找出内存限制并扩展 R 的最大数量:

memory.limit()
# set max memory usage is 2G
memory.size(max=2000)
于 2015-11-03T02:08:51.343 回答