我有一个大的制表符分隔数据表,我试图使用data.table包fread函数读入R。但是,fread遇到错误。如果我使用read.delim,表格会被正确读入,但我无法弄清楚如何配置fread以便它正确处理数据。
为了找到解决方案,我已经安装了data.table的开发版本,因此我目前正在运行Ubuntu 15.10的R v3.2.2下运行data.table v1.9.7。
我已将问题隔离到我的大桌子的几行,你可以download it here。
当我使用fread时:
> fread('problemRows.txt')
Error in fread("problemRows.txt") :
Expecting 8 cols, but line 3 contains text after processing all cols. It is very likely that this is due to one or more fields having embedded sep=',' and/or (unescaped) '\n' characters within unbalanced unescaped quotes. fread cannot handle such ambiguous cases and those lines may not have been read in as expected. Please read the section on quotes in ?fread.
我尝试使用read.delim使用的参数:
fread('problemRows.txt', sep="\t", quote="\"")
但我得到同样的错误。
有关如何正确阅读此内容的任何想法?我不确定究竟是什么问题。
谢谢!