[R] Using East-european characters in R
Vaidotas Zemlys
mpiktas at gmail.com
Fri Nov 5 08:19:51 CET 2004
Hi,
On Tue, 2 Nov 2004 15:54:30 +0100, Aleš Žiberna
<ales.ziberna at guest.arnes.si> wrote:
> Does anybody know how to produce a East-European character "č" - "c with a
> v-shaped hat " in R (in text or plot)?
>
> I do know how to get "š,ž" - "s,z, with a v-shaped hat", but not this one.
>
> Thanks in advance for any suggestions,
>
> Ales Ziberna
>
> P.S.: I am using Windows XP and R version 1.9.1 (details below)
>
If you want to produce postscript you can set the encoding. This is an
ilustration how one can get all the lithuanian letters (šžč are among
them). Source this code and run TestChars()
TestChars <- function(encoding="latin7x", family="URWHelvetica") {
postscript(encoding=encoding,family=family)
par(pty="s")
plot(c(-1,-1), c(-1,-1),
xlim=c(0,8),ylim=c(0,32),xlab="ĄČĘĖĮŠŲŪŽ", ylab="ąčęėįšųūž")
title(paste("Lietuviška simbolių koduotė", encoding))
# grid(255, 255, lty=1)
x <- rep(1:8,each=32)
y <- rep(32:1,8)
for(i in c(1:256)) {
points(x[i], y[i], pch=i-1)
}
dev.off()
}
The encoding file used is attached. You can get the one you need from
TeX instalations, look at dvips folder in main texmf tree. You must
copy it to afm folder in main R instalation tree.
Caveats:
1. You must use the text editor which supports different encodings.
The title and axis labels of the example plot will be displayed
correctly if the function is sourced in iso8859-13 encoding.
2. The font used must have the characters (glyphs) described in
encoding. That's why I used URWHelvetica, it is provided with default
instalation of R.
PS I do not know how gmail handles the encodings, so the text maybe
mangled, also R-help list may cut my attachment. Mail me privately
then.
More information about the R-help
mailing list