简体   繁体   English

如何创建以希腊符号作为列名的数据框?

[英]How do I create a data frame with greek symbols as the column names?

I am trying to build a data frame with greek letters as the column names, but using expression() does not seem to work.我正在尝试构建一个以希腊字母作为列名的数据框,但使用 expression() 似乎不起作用。

I create the data frame like so:我像这样创建数据框:


random_parameter<-rep(c(0,.5,1),3)
radiusCluster_parameter<-rep(c(100,300,600),each=3)
Cluster_metric<-rep(NA,length(radiusCluster_parameter))
parameter_table<-data.frame(random_parameter,radiusCluster_parameter,Cluster_metric)
colnames(parameter_table)<-c("R", expression(rho),expression(sigma))

But this creates a data frame with the column names "R","rho" and "sigma".但这会创建一个列名为“R”、“rho”和“sigma”的数据框。 I'd prefer the actual "R", "ρ" and "σ".我更喜欢实际的“R”、“ρ”和“σ”。

Just add the greek character set so it can read the greek letters只需添加希腊字符集,以便它可以读取希腊字母

Sys.setlocale(category = "LC_ALL", locale = "Greek")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM