R is the input file arabic?

I am writing a program that reads Arabic text from a text file in R, whenever I read a file, I get the following errors:

Warning messages: 1: In read.table("C:\\Users\\Mustafa\\Desktop\\arabic.txt", sep = "\n", : invalid input found on input connection 'C:\Users\Mustafa\Desktop\arabic.txt' 2: In read.table("C:\\Users\\Mustafa\\Desktop\\arabic.txt", sep = "\n", : incomplete final line found by readTableHeader on 'C:\Users\Mustafa\Desktop\arabic.txt' File<-read.table("C:\\Users\\Mustafa\\Desktop\\arabic.txt",sep=" \n",col.names="ar",fileEncoding="UTF-8") 

I have no idea where the error is, the environment I use is windows, on mac os this file works, however I have to run it on windows! any help is appreciated.

Thanks!

+4
source share
2 answers

This error message means that your file does not end with an EOL (end of line) character, for example. \n or \r\n .

This is a warning type that may not fill your file. On the MAC, it seems to be ignored, but on windows is considered an error.

The solution is easy, just add a new line at the end of your file, save it and try again.

+1
source

The following code worked for me.

 Sys.setlocale("LC_ALL","Arabic") 
0
source

Source: https://habr.com/ru/post/1442635/


All Articles