0

I have a problem with R on my windows XP and rstudio

I have inputs in hebrew, chinese and other languages with accentuated letters. All characters are displayed on my console and editor but not in the dataframe...

d <- data.frame(beta=c("לחשיקר","'וקויכחגקכ"), gamma=c("gö", "áóò"), delta= c("可可","是"))

head(d)

this is the output

> d <- data.frame(beta=c("לחשיקר","'וקויכחגקכ"), gamma=c("Hö", "áóò"), delta= c("可可","是"))
> head(d)
                                                                       beta gamma            delta
1                          <U+05DC><U+05D7><U+05E9><U+05D9><U+05E7><U+05E8>    Hö <U+53EF><U+53EF>
2 '<U+05D5><U+05E7><U+05D5><U+05D9><U+05DB><U+05D7><U+05D2><U+05E7><U+05DB>   áóò         <U+662F>

I have read that I can set my locale to chinese or hebrew and so on, but is there a locale to have all characters simultaneously ? Is it possible to have this on linux if it is impossible on windows ?

I use my data to print graphs with ggplots, via

color=

to go throughout all my colums containing these foreign terms, and of course, the unicodes appear in my legend. Is it possible to at least change these, by hand, in the legend to the true characters in the original languages ?

This is my system on windows 32 bits (I do not have linux presently)

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                           LC_TIME=English_United States.1252    
  • can you, provide more information about your system?. `Sys.info()` in the console. If you are on linux this [post](http://stackoverflow.com/questions/21010474/how-to-read-chinese-in-rstudio-on-linux/28792167#28792167) might help – DJJ Mar 06 '15 at 08:37
  • Have you tried to fiddle with `read.table(..., encode = "x")` (where x is encoding, like UTF-8 or whichever applies to your languages) when reading in files into R? – statespace Mar 06 '15 at 08:43
  • @DJJ First line of the question. –  Mar 06 '15 at 08:57
  • I tried this `write.table(d, "c:/mydata.txt", sep="\t", fileEncoding = "ISO-8859-1") read.table("c:/mydata.txt", fileEncoding = "ISO-8859-1")` and changing the hebrew encoding with the UTF-8 but the characters are not recognized, they remain in or turn into gibberish once I save them in one encoding and load them with another one. – user3607944 Mar 06 '15 at 09:17
  • you need to change the locale in R `?Sys.setlocale `. For example for French `Sys.setlocale("LC_ALL","fr_FR.utf8")` would do the job for a gnu/linux distribution – DJJ Mar 06 '15 at 09:39
  • Yes, but is there a locale for chinese+hebrew+roman language ? – user3607944 Mar 06 '15 at 10:14

0 Answers0