Ошибка чтения файла UTF-8 в R с использованием read.delim - PullRequest
0 голосов
/ 11 апреля 2019

Пожалуйста, помогите с ниже.Я пытаюсь прочитать файл в формате UTF-8 в Windows.

PackPM <- read.delim(paste0(getwd(), "/", checkID - 1, "_", checkID - 1, "/61351004C/61351004_DMPack.txt"), sep = "~", col.names = c("..."), stringsAsFactors = F, encoding = "UTF-8")

Приведенный выше сценарий выдает предупреждение, но созданный кадр данных имеет неправильный формат.

Warning messages:
1: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  line 1 appears to contain embedded nulls
2: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  line 2 appears to contain embedded nulls
3: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  line 3 appears to contain embedded nulls
4: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  line 4 appears to contain embedded nulls
5: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  line 5 appears to contain embedded nulls
6: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  header and 'col.names' are of different lengths
7: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  :
  embedded nul(s) found in input

Пожалуйста помоги.Дайте мне знать, если вам нужны дополнительные сведения.

Текущий язык:

> Sys.getlocale()
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"

Файл: enter image description here

Как прочитано: enter image description here

...