[R-SIG-Mac] R.app stange behavior?

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Dec 29 14:53:31 CET 2007


I am not sitting in front of my Mac, so some of this is by remote login 
and some from memory.

On Sat, 29 Dec 2007, Philippe Grosjean wrote:

> Hello,
>
> I have a couple of questions regarding the way R.app works:
>
> 1) R.app forces \n at the end of output:
>
> > cat("some text")
> some text
> >
>
> While on any other R console I have tested (including R in a terminal on
> a Mac), it is not the case:
> > cat("some text")
> some text>
>
> This is a problem for two reasons: (1) Mac users may forgot to add \n
> when using cat() and it would produce weird results elsewhere, and (2)
> it is sometimes useful to be able to write something before the prompt,
> or to write text without \n (see progress() in svMisc package, for an
> example of use)

That surely is a bug: however my memory the line is being completed when 
input is required.  Handling that 'properly' in a console is hard 
programming work.

> 2) R.app does not interpret \a and \b. \a should output a sound ('bip')
> and is used in alarm() function that does not work in R.app, and \b is
> backspace and is supposed to erase previous character. Consequently:
>
> > cat("abc\bd\n")
> abcd
> >
>
> which is wrong, or at least, different from the behavior on all other R
> consoles I have used which gives:
>
> > cat("abc\bd\n")
> abd
> >

How control characters are interpreted is terminal-dependent and can often 
be selected for a terminal.  But it would seem sensible for R.app to 
follow the usual interpretations.

> 3) Despite reading Mac-FAQ, I cannot figure out how to print French
> messages correctly. I got something like:
>
> > nonexistingvar
> Erreur : objet "nonexistingvar" non trouv'e
> >
>
> This is the same on the terminal. Under Windows (RGui), I got:
>
> > nonexistingvar
> Erreur : objet "nonexistingvar" non trouvé
> >
>
> How can I fix this? (I am the maintainer of R French translation, and it
> uses 'charset=ISO-8859-1').

Irrelevant: the C-level gettext code does all the re-encodings needed.

> I don't know if this should be considered as bugs, or if I miss some
> point here.

The latter works correctly if I set the locale on the command line, so 
must be an issue with locales.  E.g. in a terminal

blacklark% env LC_ALL=fr_FR.UTF8 R
> nonexistingvar
Erreur : objet "nonexistingvar" non trouvé

My understanding is that R.app is supposed to interpret Mac OS language 
preferences as locales, and it seems that this is not working correctly 
for you. I would expect

Sys.setenv(LANGUAGE="fr")

to fix this up in the session: it does for me in a terminal session (which 
gives UTF-8 output even in a C locale).

-- 
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-SIG-Mac mailing list