Skip to content

Using East-european characters in R

5 messages · PIKAL Petr, Brian Ripley, Vaidotas Zemlys +1 more

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

$platform

[1] "i386-pc-mingw32"



$arch

[1] "i386"



$os

[1] "mingw32"



$system

[1] "i386, mingw32"



$status

[1] ""



$major

[1] "1"



$minor

[1] "9.1"



$year

[1] "2004"



$month

[1] "06"



$day

[1] "21"



$language

[1] "R"
#
Hi

It is hidden somewhere in docs (probably FAQs) and you can 
maybe find some answers in help archives.

Basically you probably need

- appropriate fonts set in Rconsole and Rdevga files (e.g. Courier 
instead of Courier New)

see attached my versions.

Cheers
Petr
On 2 Nov 2004 at 15:54, Ale? ?iberna wrote:

            
Petr Pikal
petr.pikal at precheza.cz


-------------- next part --------------
# The system-wide copy is in rwxxxx/etc.
# A user copy can be installed in `R_USER'.

# Format is 
# [TT] face:style
# where style is plain, bold, italic or bold&italic.
# If 'TT' is present, only True Type fonts are searched.
# Remarks:
#   (a) Windows graphics engine can only rotate True Type fonts;
#   (b) Only the first 32 fonts will be used.

TT Arial : plain
TT Arial : bold
TT Arial : italic
TT Arial : bold&italic

# Please, don't change the following definition. The plot math engine
# assumes that font5 contains greek letters and math symbols
TT Symbol: plain

TT Times New Roman : plain
TT Times New Roman : bold
TT Times New Roman : italic
TT Times New Roman : bold&italic
TT Courier New: plain
TT Courier New: bold
TT Courier New: italic
TT Courier New: bold&italic

TT Century Gothic : plain
TT Century Gothic : bold
TT Century Gothic : italic
TT Century Gothic : bold&italic

TT Matisse ITC: plain
TT Wingdings: plain
-------------- next part --------------
# Optional parameters for the console and the pager
# The system-wide copy is in rwxxxx/etc.
# A user copy can be installed in `R_USER'.

## Style
# This can be `yes' (for MDI) or `no' (for SDI).
MDI = yes
# the next two are only relevant for MDI
toolbar = yes
statusbar = yes

## Font.
# Please use only fixed width font.
# If font=FixedFont the system fixed font is used; in this case
# points and style are ignored. If font begins with "TT ", only
# True Type fonts are searched for.
font = TT Courier New
points = 10
style = normal # Style can be normal, bold, italic


# Dimensions (in characters) of the console.
rows = 25
columns = 80
# Dimensions (in characters) of the internal pager.
pgrows = 25
pgcolumns = 80
# should options(width=) be set to the console width?
setwidthonresize = yes

# memory limits for the console scrolling buffer, in bytes and lines
bufbytes = 65000
buflines = 8000

# Initial position of the console (pixels, relative to the workspace for MDI)
# xconsole = 0
# yconsole = 0

# Dimension of MDI frame in pixels
# Format (w*h+xorg+yorg) or use -ve w and h for offsets from right bottom
# This will come up maximized if w==0
# MDIsize = 0*0+0+0
# MDIsize = 1000*800+100+0
# MDIsize = -50*-50+50+50  # 50 pixels space all round

# The internal pager can displays help in a single window
# or in multiple windows (one for each topic)
# pagerstyle can be set to `singlewindow' or `multiplewindows'
pagerstyle = multiplewindows


## Colours for console and pager(s)
# (see rwxxxx/etc/rgb.txt for the known colours).
background = White
normaltext = NavyBlue
usertext = Red
highlight = DarkRed


## Initial position of the graphics window 
## (pixels, <0 values from opposite edge)
xgraphics = -25
ygraphics = 0
#
On Wed, 3 Nov 2004, Petr Pikal wrote:

            
Yes, it is in the rw-FAQ, the question headed

 I don't see characters with accents at the R console, for example in ?text.

which seems an obvious enough heading to expect people to look at it.
That's there too.
1 day later
#
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.
1 day later
#
Thanks to everyone for usful tips. I managed to solve the problem by 
corecting fonts in Rconsole and Rdevga!

Ales Ziberna