R语言read.table()报错: EOF within quoted string

(1)今天在读取数据的时候,出现一个报错:
f_anno <- read.table("anno_new.txt", 
                      sep = "\t", 
                      header = T, 
                      check.names = F,
                      fill = T, 
                      na.strings = "")

Warning message:
In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
EOF within quoted string

(2)解决方法:

方法一:调用Sys.setlocale("LC_ALL", "English")
方法二:禁用qutoe,即设置quote = "",你把语句改为sms_raw <- read.csv("E:/R/mlrdatasets/sms_spam.csv", stringsAsFactors = FALSE,quote = "")
方法三:编码问题,把读取编码设置为fileEncoding = "Latin1"
我选用了方法二,目前已经解决。
原文链接:https://blog.csdn.net/liuhuanheng/article/details/96380583

你可能感兴趣的:(R语言read.table()报错: EOF within quoted string)