R语言:Error in (, unique = TRUE) : ‘<ff><fe><4e>‘多字节字符串有错

时间:2025-02-09 14:25:33

Error in (, unique = TRUE) : 
  '<ff><fe><4e>'多字节字符串有错
此外: Warning messages:
1: In ("", header = TRUE, sep = "\t") :
  line 1 appears to contain embedded nulls
2: In ("", header = TRUE, sep = "\t") :
  line 2 appears to contain embedded nulls
3: In ("", header = TRUE, sep = "\t") :
  line 3 appears to contain embedded nulls
4: In ("", header = TRUE, sep = "\t") :
  line 4 appears to contain embedded nulls
5: In ("", header = TRUE, sep = "\t") :
  line 5 appears to contain embedded nulls

 

使用读取txt时遇到如下错误,

我的做法是,把你需要读取的txt文本另存为,编码格式选择UTF-8即可

 

另外网传增加一个参数 fileEncoding="你txt的编码类型" 应该也是可行的