[R] ASCII character set and hyphen
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Nov 19 18:43:13 CET 2007
On Mon, 19 Nov 2007, Roland Kaiser wrote:
> Hi all!
>
> To add to my previous posting
> I want to give some more deatils give a more precise
>
> I want to print a hyphen to a pdf() or postscript() device.
> As the documentaion of postscript says
> ASCII Character 45("-") is mapped to a minus sign (ASCII Character
> 95) by default.
> The advice given is to use "\173" for a hyphen.
>
> But, the following code produces a curly brace
> instead of a hyphen.
>
> Thanks for any advice?
Check your reading before posting? The advice actually is
There is an exception. Character 45 ('"-"') is always set as
minus (its value in Adobe ISOLatin1) even though it is hyphen in
the other encodings. Hyphen is available as character 173 (octal
0255) in all the Latin encodings, Cyrillic and Greek.
So try "\255". And please don't post twice.
>
> Roland
>
> library(rgr)
> pdf("foo.pdf", encoding = "ISOLatin1")
> display.ascii.d()
> mtext("\173", side = 3)
> dev.off()
>
>
> R version 2.6.0 (2007-10-03)
> i386-apple-darwin8.10.1
>
> locale:
> de_AT.UTF-8/de_AT.UTF-8/de_AT.UTF-8/C/de_AT.UTF-8/de_AT.UTF-8
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] rgr_1.0.3 MASS_7.2-36 akima_0.5-1
>
> ______________________________________________
> 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