从R导出阿拉伯文 [英] Exporting Arabic Text from R

查看:210
本文介绍了从R导出阿拉伯文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当R导入阿拉伯文本时,将其转换为UTF-8代码。像这样:

 < U + 0627>< U + 0644>< U + 0641>< U + 0631& ;< U + 0639> < U + 0627>< U + 0644>< U + 062A>< U + 0634>< U + 0631>< U + 064A>< U + 0639>< U + 064A>< U + 060C> < U + 0627>< U + 0644>< U + 0641>< U + 0631>< U + 0639> < U + 0627>< U + 0644>< U + 062A>< U + 0646>< U + 0641>< U + 064A>< U + 0630>< U + 064A>< U + 060C>< U + 0627>< U + 0644>< U + 0641>< U + 0631>< U + 0639> < U + 0627>< U + 0644>< U + 0642>< U + 0636>< U + 0627>< U + 0626>< U + 064A取代。 < U + 0627>< U + 0644>< U + 062D>< U + 0643>< U + 0648>< U + 0645>< U + 0629> < U + 0627>< U + 0644>< U + 0641>< U + 062F>< U + 0631>< U + 0627>< U + 0644>< U + 064A> 

不幸的是,导出时我无法将其转换成可读阿拉伯语。以下是我正在使用的代码...

  write.csv(my.data,data.csv,fileEncoding = 'UTF-8')

有人有解决方案吗?



另外,这里是我的会话信息。

  R版本3.0.1(2013-05-16)
平台:x86_64-w64-mingw32 / x64(64位)

语言环境:
[1] LC_COLLATE = English_United States.1252 LC_CTYPE = English_United States.1252
[3] LC_MONETARY = English_United States.1252 LC_NUMERIC = C
[5] LC_TIME = English_United States.1252

附加的基本包:
[1]统计图形grDevices utils数据集方法

其他附加包:
[1] ggplot2_0.9.3.1

通过命名空间加载(并未附加):
[1] colorspace_1.2-2 dichromat_2.0-0 digest_0.6.3 grid_3.0.1 gtable_0.1.2
[6] labels_0.2 MASS_7.3-27 munsell_0.4.2 plyr_1.8 proto_0.3-10
[11] RColorBrewer_1.0-5 reshape2_1.2.2 scales_0.2.3 stringr_0.6.2 tools_3.0.1


解决方案

您必须安装和使用区域设置。这很困难,有时不起作用。



这里提供了一些解决方案和代码:编写数据不保留编码



请记住,您实际上需要为您的操作安装语言包系统,对于某些Windows版本,根本没有任何可用的。


I'm trying to export a data frame with Arabic text in R.

When R imports Arabic text it converts it to UTF-8 codes. Like this:

     <U+0627><U+0644><U+0641><U+0631><U+0639> <U+0627><U+0644><U+062A><U+0634><U+0631><U+064A><U+0639><U+064A><U+060C> <U+0627><U+0644><U+0641><U+0631><U+0639> <U+0627><U+0644><U+062A><U+0646><U+0641><U+064A><U+0630><U+064A><U+060C><U+0627><U+0644><U+0641><U+0631><U+0639> <U+0627><U+0644><U+0642><U+0636><U+0627><U+0626><U+064A>. <U+0627><U+0644><U+062D><U+0643><U+0648><U+0645><U+0629> <U+0627><U+0644><U+0641><U+062F><U+0631><U+0627><U+0644><U+064A>

Unfortunately, I can't get it to turn back into readable Arabic when exporting. Below is code I'm using...

    write.csv(my.data,"data.csv", fileEncoding='UTF-8') 

Anybody have a solution?

Also, here is my session info.

R version 3.0.1 (2013-05-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggplot2_0.9.3.1

loaded via a namespace (and not attached):
[1] colorspace_1.2-2   dichromat_2.0-0    digest_0.6.3       grid_3.0.1   gtable_0.1.2      
[6] labeling_0.2       MASS_7.3-27        munsell_0.4.2      plyr_1.8           proto_0.3-10      
[11] RColorBrewer_1.0-5 reshape2_1.2.2     scales_0.2.3       stringr_0.6.2      tools_3.0.1       

解决方案

You'll have to install and use locales. It's difficult and sometimes doesn't work.

There's some solutions and code offered here: Writing data isn't preserving encoding

Keep in mind that you actually HAVE to install language packs for your operating system and for some Windows versions there aren't any available separately at all.

这篇关于从R导出阿拉伯文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆