在R中导入Urdu数据集

时间:2018-09-13 11:02:37

标签: r csv

我正在尝试在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'

1 个答案:

答案 0 :(得分:0)

您的文件可能以unicode编码(可以包含zero bytes),因此您可能必须使用utf-16而不是"Urdu"和/或encoding='UTF-16'read.csv()通话中。

此外,定界符为tab。确保提供该参数作为参数,以防读者默认使用,sep = '\t'