[R] New problem printing °C in plots

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Feb 2 00:33:37 CET 2005


That this prints as an octal escape was always the intention: it is your 
OS that is telling R that it is not a printable character.  What locale 
are you in?  For me

1) In en_GB this works (correct, as that is charset ISO-8859-1)
2) In C, I get "25\260C" (correct, as that is not an ASCII char)

My guess is that you have R running in a C locale and emacs in a UTF-8 
locale, since the UTF-8 representation of that symbol is c2b0, in octal 
\302\260.  If that is what is going on, 1.8.1 would have been equally 
confused (it might have printed UTF-8, but it would not plot it), so I 
suspect the important change is not the one you think it is.

Note that at least one set of RPMs now runs R in the C locale (but that's 
not part of R per se).  If you run in en_NZ I think you will find R works 
to your taste.  The good news is that R-devel already supports en_NZ.utf8, 
and so 2.1.0 will in a couple of months.

On Wed, 2 Feb 2005, Patrick Connolly wrote:

>> version
>         _
> platform i686-pc-linux-gnu
> arch     i686
> os       linux-gnu
> system   i686, linux-gnu
> status
> major    2
> minor    0.1
> year     2004
> month    11
> day      15
> language R
>> paste("25", "°C", sep = "")
> [1] "25\302\260C"
>
> In ESS, I get  "25\201\260C"
>
> The °C does end up in the plot alright, but it has an accented A as
> well which is not useful.
>
> (The '°C' I get from within Emacs using C - x 8 - o)
> GNU Emacs 21.3.1

BTW, the plot device matters too.

> In earlier versions, I used to get this:
>
>> version
>         _
> platform i686-pc-linux-gnu
> arch     i686
> os       linux-gnu
> system   i686, linux-gnu
> status
> major    1
> minor    8.1
> year     2003
> month    11
> day      21
> language R
>> paste("25", "°C", sep = "")
> [1] "25°C"
>>
>
> That plotted fine.  I can't remember if the problem existed with
> R-2.0.0 and I didn't notice a mention the NEWS file/s -- but that
> could be because I didn't know what to look for.
>
> Could this be purely an Emacs problem, or does it have to do with
> changes in R-2.x.x?

Neither of those, is my guess.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-help mailing list