R appears not to handle arabic text very well. Though it is possible to type some arabic strings like
Names <- c("سليم", "سعيد", "مجدى").
Now I use word or excel to write longer lists of name and save the file as text. I can import the file in R (RStudio) and display correctly the imported data. However, I can not manipulate the imported list. Plotting for example produces funny characters. why directly typed lists (not easy at all) can be plotted but not the imported list?
I am using windows 7, R v.3.0.2, and RStudio to read the file.
Any help on using arabic text in R will be appreciated. Thanks
If you save you text with encoding 'UTF-8' ( For example using Rstudio, create a text file and then from menu use "Save with encoding..." and choose UTF-8), Then you can read it easily:
readLines('d:/temp/arabic.txt',encoding='UTF-8')
[1] "\"سليم\" \"سعيد\" \"مجدى\""
Or using scan
:
scan("arabic",encoding='UTF-8',what='character',sep=',')
Read 3 items
[1] "سليم" " سعيد" " مجدى "
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With