[R] Change the language of the labels in a graph

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Apr 25 08:13:08 CEST 2006


LANGUAGE controls the language of message translations: see the R-admin 
manual, which incidentally also points out you should not expect to change 
that whilst R is running.

Second, your input dates are in English so you need English as the 
language for your as.Date command.  The following works for me

x <- as.Date(c("1jan1960", "2jan1960", "31mar1960", "30jul1960"), "%d%b%Y")
Sys.setlocale("LC_TIME", "fr_CA")
plot(x, 1:4)

but you haven't told us your OS and the locale name will be 
OS-dependent (and so may the abbreviations).

On Mon, 24 Apr 2006, Lapointe, Pierre wrote:

> Hello,
>
> How do you change the language of the labels in a graph.  In this example, I
> want to get French labels by changing Sys.putenv.  I should get "Mai"
> instead of "May".
>
> Sys.putenv(LANGUAGE="fr")
> x <- as.Date(c("1jan1960", "2jan1960", "31mar1960", "30jul1960"), "%d%b%Y")
> y <-1:4
> plot(x,y)
>
>
> Regards,
>
> Pierre Lapointe
>
>
> **************************************************
> AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}}
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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