将阿拉伯文本分配给R变量 [英] Assigning Arabic text to R variables
本文介绍了将阿拉伯文本分配给R变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
R不正确显示阿拉伯语文本。当我使用阿拉伯语时,我会感到非常奇怪的东西。这是一个截图:
R doesn't display correctly Arabic text. I get very weird stuff when I use Arabic. Here's a screenshot:
问题是我想用阿拉伯文本创建一个wordcloud,我需要先解决这个问题。
The problem is that I want to create a wordcloud with Arabic text and I need to solve this problem first.
R版本:R 2.15.2 GUI 1.53豹构建64位(6335)
R version: R 2.15.2 GUI 1.53 Leopard build 64-bit (6335)
以下是更多信息:
> options("encoding")
$encoding
[1] "native.enc"
> Encoding("الله")
[1] "unknown"
SessionInfo() / p>
SessionInfo():
> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
locale:
[1] C/C/C/C/de_DE/C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_2.15.2
>
有些修补:
> x = "مرحبا"
> Encoding(x) = "UTF-8"
> x
[1] "<U+0645><U+0631><U+062D><U+0628><U+0627>"
> Encoding(iconv(x))
[1] "unknown"
更多信息: / p>
More info:
> Sys.getlocale()
[1] "C/C/C/C/de_DE/C"
> Sys.setlocale("LC_ALL", "en_US.utf8")
[1] ""
Warning message:
In Sys.setlocale("LC_ALL", "en_US.utf8") :
OS reports request to set locale to "en_US.utf8" cannot be honored
>
解决了这个问题:
Sys.setlocale("LC_ALL", "en_US.UTF-8")
推荐答案
这样做:
Sys.setlocale("LC_ALL", "en_US.UTF-8")
这篇关于将阿拉伯文本分配给R变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文