我试图在R中导入这样的数据集,但这给我带来了错误。我做错什么了吗?
代码:
library(rio)
Sys.setlocale("LC_ALL","Urdu")
fil <- read.csv("D:/PycharmProjects/shiny-examples-master/shiny-examples-master/Data_set.csv",encoding='UTF-8')Data_set.csv:
Reg No. address
13 Nazim ud Din Road, F-11, ICT, وفاقی دارالحکومت اسلام آباد, 44000, پاکستان
45 Street 34, F-7/1, F-7, ICT, وفاقی دارالحکومت اسلام آباد, 44000, پاکستان
5564 Lane 11, DHA Phase II, ICT, وفاقی دارالحکومت اسلام آباد, 44000, پاکستان错误:
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, :
incomplete final line found by readTableHeader on 'D:/PycharmProjects/shiny-examples-master/shiny-examples-master/12000.csv'发布于 2018-09-13 12:34:24
您的文件可能是用unicode编码的(其中可以包含zero bytes),因此您可能不得不在read.csv()调用中使用utf-16而不是"Urdu"和/或encoding='UTF-16'。
另外,分隔符是tab。如果读取器默认为,:sep = '\t',请确保提供该参数。
https://stackoverflow.com/questions/52312348
复制相似问题