我嘗試將大文件讀入r。在嘗試閱讀時發生此錯誤。即使當我跳過第一條800607線時,它也不會消失。我也嘗試用命令刪除終端中的行。跳過在fread中產生錯誤的行/行R
sed '800608d' filename.csv
它沒有解決我的問題。如果你能幫助我,我將不勝感激。
原來的錯誤,我自R得到的是:
> data<-fread("filename.csv")
Read 2.0% of 34143409 rows
Error in fread("filename.csv") :
Field 16 on line 800607 starts with quote (") but then has a problem. It can contain balanced unescaped quoted subregions but if it does it can't contain embedded \n as well. Check for unbalanced unescaped quotes: """The attorney for Martin's family, Benjamin Crump, says the evidence is ""irrelevant\"""" """".","NULL","NULL","NULL","NULL","NULL","NULL","NULL","Negative"
In addition: Warning message:
In fread("filename.csv") :
Starting data input on line 8 and discarded previous non-empty line: done
這是一個非常棘手的問題。問題在於你的文件中有一列使用與文件結構相同的特殊字符(「用於引用」,「作爲分隔符等),所以它完全混淆了文件格式。理想的方法是更改文件格式,如果您有權訪問源文件,例如,將默認引號字符設置爲'而不是「。否則,提供實際的文件將會很有幫助,這樣我們也可以看看它 –
不幸的是,我不允許訪問,並且更改文件格式需要很長時間。 – Carlo