I am trying to open a UTF-8 encoded CSV file that contains (traditional) Chinese characters in R. For some reason, R displays information sometimes as Chinese characters, sometimes as Unicode characters.
For instance:
data <-read.csv("mydata.csv", encoding="UTF-8") data
will output Unicode characters, and:
data <-read.csv("mydata.csv", encoding="UTF-8") data[,1]
will display chinese characters.
If I turn it into a matrix, it will also display Chinese characters, but if I try to look at the data (View (data) or fix (data) command), it will reappear in unicode.
I asked for advice from people who use a Mac (I use a PC, Windows 7), and some of them got Chinese characters, others didn't. I tried saving the original data as a table instead and reading it in R that way - the same result. I tried to run the script in RStudio, Revolution R and RGui. I tried to configure the locale (for example, in Chinese), but either R did not allow me to change it, or the result was gibberish instead of Unicode characters.
My current language:
"LC_COLLATE = French_Switzerland.1252; LC_CTYPE = French_Switzerland.1252; LC_MONETARY = French_Switzerland.1252; LC_NUMERIC = C; LC_TIME = French_Switzerland.1252"
Any help to get R to constantly display Chinese characters would be greatly appreciated ...
source share