Why do some Unicode characters display in matrices, but not data frames in R?

前端 未结 2 1305
萌比男神i
萌比男神i 2020-11-30 03:22

For at least some cases, Asian characters are printable if they are contained in a matrix, or a vector, but not in a data.frame. Here

2条回答
  •  一生所求
    2020-11-30 04:10

    I just blogged about Unicode and R several days ago. I think your R editor is UTF-8 and this gives your illusion that R in your Windows handles UTF-8 characters.

    The short answer is when you want to process Unicode (Here, it is Chinese), don't use English Windows, use a Chinese version Windows or Linux which by default is UTF-8.

    Session info in my Ubuntu:

    > sessionInfo()
    R version 2.14.1 (2011-12-22)
    Platform: i686-pc-linux-gnu (32-bit)
    
    locale:
     [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
     [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=C                 LC_NAME=C                 
     [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
    

提交回复
热议问题