在下面列出的规格下,data.frame
对象在打印表格时将希腊字符转换为拉丁语等效字符。例如,
w<-data.frame(A=c("σ", "a", "b"))
print(w)
# A
# 1: s
# 2: a
# 3: b
如果将“σ”替换为“ \ U03C3”,也会发生同样的情况。
data.frame
似乎可以互换地对待“σ”和“ s”:
w<-data.frame(σ=1:4)
w$σ
# [1] 1 2 3 4
w$s
# [1] 1 2 3 4
但是在打印方面,它偏爱拉丁版本。
但是,向量(与列表一起)显示的行为略有不同:
x=c("σ", "a", "b")
x
# [1] "s" "a" "b"
x=c("\U03C3", "a", "b")
x
# [1] "σ" "a" "b"
有没有一种方法可以强制data.frame
对象打印“σ”而不是“ s”?
输出
sessionInfo()
# R version 3.4.4 (2018-03-15)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# Running under: Windows >= 8 x64 (build 9200)
# Matrix products: default
# locale:
# [1] LC_COLLATE=German_Switzerland.1252LC_CTYPE=German_Switzerland.1252 LC_MONETARY=German_Switzerland.1252 LC_NUMERIC=C
# [5] LC_TIME=German_Switzerland.1252
# attached base packages:
# [1] stats graphics grDevices utils datasets methods base
# other attached packages:
# [1] openxlsx_4.1.0 data.table_1.11.4
# loaded via a namespace (and not attached):
# [1] compiler_3.4.4 tools_3.4.4 Rcpp_0.12.19 zip_1.0.0