make.names(col.names,unique = TRUE)中的错误:'<ff> <fe> <0a> <ff> <fe>'处的无效多字节字符串

时间:2018-12-05 22:27:50

标签: r

我正在尝试读取此分隔的文本文件。它标记为.csv,但表示它是UTF-16 Unicode Text.txt文件。我在做什么错了?

    df <- read.delim("/Users/admin/Downloads/data1.csv", sep = ",")

    Error in make.names(col.names, unique = TRUE) : 
  invalid multibyte string at '<ff><fe>

<0a>

<ff><fe>'

    warnings()
    Warning messages:
    1: In grep("^[^#].*", lines, value = TRUE) :
      input string 1 is invalid in this locale
    2: In read.table(path, encoding = encoding, header = header,  ... :
      line 1 appears to contain embedded nulls

1 个答案:

答案 0 :(得分:0)

我在读取.csv文件时遇到了相同的错误:

位于无效的多字节字符串

看看FileEconding。就我而言,我使用的是:fileEncoding="latin1"

以下是文档:

https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Encoding