[R] special characters in linux using dev.print

Alexander.Herr at csiro.au Alexander.Herr at csiro.au
Mon Oct 8 09:19:31 CEST 2007


Thanks Brian,

I got lost with the coding between windows and linux. I used the ± (Windows: Alt-0177, instead of "\u00B1") in a code writen under windows and than used on linux.

eg:
plot(1:10)
text(3,8,paste("±", "alt-numeric 0177 works only in windows",sep="")) 
text(8,3,paste("\u00B1"," \\u00B1 works on both platforms",sep="")) 

Cheers
Herry


-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] 
Sent: Monday, October 08, 2007 4:36 PM
To: Herr, Alexander Herr - Herry (CSE, Townsville)
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] special characters in linux using dev.print

How exactly are you doing this (see the footer of your message for the input we asked for)?  What is your 'minimal, self-contained, reproducible code', and where is the output of sessionInfo()?

The plusminus symbol is in the symbol font, and it is also in some text encodings, so there are several routes you could have taken. For example,

pdf()
plot(1:10)
text(4,5,"\u00B1")

works for me in a UTF-8 locale.  (It works in any locale that has the symbol in its encoding.)


On Mon, 8 Oct 2007, Alexander.Herr at csiro.au wrote:

> Hi List,
>
> I want to print ± in a lattice graph label. This works in windows, but 
> the linux version has problems - it cannot translate the character. 
> Error is "invalid input in mbcsToLatin1".
>
> I use the standard encoding and also dev.print(file="filename",dev=pdf, 
> encoding="PDFDoc.enc")
>
> I am afraid I don't know enough about the linux font encodings to figure 
> out what to use. So I am hoping others using ± have already come across 
> the trap.
>
> Any help appreciated.
> Thanks
> Herry
>
> Using x86_64 opensuse 10.2, R2.5.0 (2007-04-23)
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
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