Skip to content
Prev 58536 / 398502 Next

Using East-european characters in R

Hi,

On Tue, 2 Nov 2004 15:54:30 +0100, Ale? ?iberna
<ales.ziberna at guest.arnes.si> wrote:
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.