I have unicode csv file:
LabelName,Label1,Label2,SpeciesLabel,Group,Subgroup,Species
التسمية 1,Group 1,Subgroup 1,Species 1,1,1,1
التسمية 2,Group 1,Subgroup 1,Species 1,1,1,1
التسمية 3,Group 1,Subgroup 1,Species 1,1,1,1
I want to read it into R, and I used this command:
Data = read.csv("Data.csv", encoding="UTF-8", fileEncoding = "UTF-8")
But I got this error:
Error in read.table(file = file, header = header, sep = sep, quote = quote, : empty beginning of file In addition: Warning messages: 1: In read.table(file = file, header = header, sep = sep, quote = quote, : invalid input found on input connection 'Data.csv' 2: In read.table(file = file, header = header, sep = sep, quote = quote, : line 1 appears to contain embedded nulls 3: In read.table(file = file, header = header, sep = sep, quote = quote, : incomplete final line found by readTableHeader on 'Data.csv'
How can I read unicode (with arabic letters) csv file in R.
Thanks!
You can read the file using
readLines
with the argumentwarn = FALSE
, then executeread.csv
withtext
argument as below:Output: