RStudio和日文字符

时间:2014-01-19 14:11:42

标签: r character-encoding rstudio

我试图让RStudio显示(使用View功能)并写入CSV(使用write.csv功能),我正在从表中读取日语字符。

这是从这个问题借来的一个例子:

    dfJap = read.table(header = TRUE, sep = ',', text = 'category,desc,otherdesc,volume
    UPC - 31401 Age Itameabura,かどや製油 純白ごま油,OIL_OTHERS_SML_ECO,83.0
    UPC - 31401 Age Itameabura,オレインリッチ,OIL_OTHERS_MED,137.0
    UPC - 31401 Age Itameabura,TVキャノーラ油,OIL_CANOLA_OTHERS_LRG,3026.0', 
fileEncoding = 'ISO-2022-JP')
    View(dfJap)

这显示使用UTF-8编码的输出而不是字符字形本身。我想知道这是否是操作系统问题。我的平台是64位Windows 7专业版。

以下是会话信息:

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

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] 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] plyr_1.8        gtools_3.1.1    ggplot2_0.9.3.1

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4   dichromat_2.0-0    digest_0.6.4      
 [4] grid_3.0.1         gtable_0.1.2       labeling_0.2      
 [7] MASS_7.3-26        munsell_0.4.2      proto_0.3-10      
[10] RColorBrewer_1.0-5 reshape2_1.2.2     rstudio_0.98.484  
[13] scales_0.2.3       stringr_0.6.2      tools_3.0.1    

1 个答案:

答案 0 :(得分:2)

此问题已在Windows post中记录为Windows中的View()错误。 cat()print.listof(., locale = locale(encoding = "SJIS"))应正确显示输出。

相关问题