I am importing a large .csv file into R (about 0.5 million lines), so I tried to use fread () from the data.table package as a faster alternative to read.table () and read.csv (). However, fread () returns a data frame with all the data from the rows on the same row, even if it has the correct number of columns. I found a 2013 error report showing that this is due to the integer64 data class:
http://r-forge.r-project.org/tracker/index.php?func=detail&aid=2786&group_id=240&atid=975
Are there any fixes or ways around this?
The .csv file I'm trying to read contains integers ranging from 0 to 10,000 without missing data. I am using R version 2.15.2 on a computer running Windows 7 with version 1.8.8 of the data.table package.
The code I run is:
require(data.table)
fread("pre2012_alldatapoints.csv", sep = ",", header= TRUE)-> pre
head(pre)
1: 1 22 -105 22 -105
2: 2 22 -105 22 -105
3: 3 20 -105 20 -105
4: 4 21 -105 21 -105
5: 5 21 -105 21 -105
6: 6 21 -105 21 -105
dim(pre)
[1] 12299 5
pre[,1]
[1] 1
length(pre[,1])
[1] 1
Many thanks for your help!
source
share