数据文件不是很大,不到150M。里面有20多万条记录,每条记录有52个变量。
<br />
data04=read.table("D_2004.txt",sep="|")<br />
但是每次都显示
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 77523 did not have 52 elements
我特意看了下那一行,应该是没有问题的。
首先,我把第77522行和第77523行单独复制到另一个新的文本文件中,然后用上面的代码读取,没有任何问题。</p>
然后我又试着把第77523行删掉,结果变成
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 77522 did not have 52 elements
再删掉第77522行,重新运行得到
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 77521 did not have 52 elements
好奇怪,大家觉得是哪里出问题了?