如何使R数据帧保持并显示unicode字符

时间:2015-04-28 18:48:34

标签: r unicode centos centos6

如何在数据框中包含希腊字母(并将其保存到Excel工作表中)?当我尝试时,它们会替换为空格(来自data_framedplyrXdata.frame)。

d <- data_frame(` L` = 5, ` ` = 6)

names(d)
#[1] " L" " " 

d <- data.frame(` L` = 5, ` ` = 6)

names(d)
#[1] "X.L" "X." 

Sys.setlocale(locale="UTF-8")
#[1] ""
#Warning message:
#In Sys.setlocale(locale = "UTF-8") :
#  OS reports request to set locale to "UTF-8" cannot be honored

cat *-release
# CentOS release 6.3 (Final)

Sys.getlocale()
#[1] "LC_CTYPE=en_US.UTF-8;
#     LC_NUMERIC=C;
#     LC_TIME=en_US.UTF-8;
#     LC_COLLATE=en_US.UTF-8;
#     LC_MONETARY=en_US.UTF-8;
#     LC_MESSAGES=en_US.iso885915;
#     LC_PAPER=en_US.iso885915;
#     LC_NAME=en_US.iso885915;
#     LC_ADDRESS=en_US.iso885915;
#     LC_TELEPHONE=en_US.iso885915;
#     LC_MEASUREMENT=en_US.iso885915;
#     LC_IDENTIFICATION=en_US.iso885915"

有趣的是,我甚至无法让它们从浏览器中显示出来。第一个空格应为greek small letter mu,第二个空格应为greek small letter beta

0 个答案:

没有答案