[ESS] "foreign" languages in R and ESS
Martin Maechler
maechler at stat.math.ethz.ch
Mon Nov 21 11:11:31 CET 2005
>>>>> "tony" == A J Rossini <blindglobe at gmail.com>
>>>>> on Sun, 20 Nov 2005 12:28:50 +0100 writes:
tony> Lots of issues with Emacs/ESS/R/UTF combinations. I
tony> think Martin had some knowledge? I don't.
"some", yes.
The main point is that ESS now (since version 5.2.6,
i.e. March'05) should work seemlessly with UTF-8 unicode, and it
does for me.
tony> On 11/19/05, Paul Johnson <pauljohn at ku.edu> wrote:
>> In R-2.2 supports Unicode characters. I'm not an multilingual, but I
>> work with a colleague who is and we want to put some foreign symbols in
>> an R picture.
>>
>> In Emacs I configure with the pull down menu Options/MULE and I use "Set
>> Language Environment" to set UTF-8 and then the input method is selected
>> there, either the default or cyrillic-ukrainian.
>>
>> Here is an R program that tries to use the cyrillic in the title of a plot:
>>
>> x <- rnorm(100)
>> y <- rnorm(100)
>> plot(x,y,main="$,1(`(c(a(a(X(P(](.(B")
>>
>> The Cyrillic shows in Emacs and it shows in my email program
>> (thunderbird), however, when I run it through R, the plot title is in
>> English, reading 'b'e'c'c'Z'Z'_
>>
>> Before I ask in the R list, I figured I should as here in ESS because I
>> figure there's a pretty good chance that there's some slippage between
>> Emacs and ESS where MULE is concerned. ?
>>
>> I'm running Fedora Core 4 with Emacs
>> emacs-ess-5.2.10
>> emacs-21.4-5
the above should definitely be fine enough {even though ESS is
now at 5.2.11}.
>> My system LANG variable is
>> $ env | grep LANG
>> LANG=en_US.UTF-8
Actually, R mainly reacts on 'LANGUAGE', not 'LANG'
and I assume your problem to be an R rather than an ESS problem.
If R thinks you're in an english locale but you want Ukrainian,
that won't work.
I assume you have a *.R script file with the above plot()
statement(s), say 'ex.R'.
What happens if you run that file via 'source()' or 'R CMD BATCH ex.R'
--> yes, it is more an R than an ESS question.
Once you know to solve the R part,
for you, it might help to define an R shell skript,
say 'R-ukr' containing
#!/bin/sh
LANGUAGE=<...>
LC_ALL=<...>
export LANGUAGE LC_ALL LC.......
R $@
where you must replace <...> with the correct string for
Ukrainain, make the script executable ("chmod +x R-ukr") and be sure
that it is in your PATH {conventional would be to have it in $HOME/bin/
and add $HOME/bin to your PATH}.
Now with a recent version of ESS (5.2.10 is sufficient),
M-x R-ukr
would automatically work.
Regards,
Martin
More information about the ESS-help
mailing list