On 09/07/12 01:43, Mikkel Grum wrote:> Dear useRs
>
> I need to do graphs with dates in different languages on Ubuntu.
>
> In Windows the following will plot the date axis labels in Spanish:
>
> random.dates <- as.Date("2001/1/1") +
70*sort(stats::runif(100))
>> language <- "Spanish"
>> Sys.setlocale("LC_TIME", language)
>> plot(random.dates, 1:100, xaxt="n")
>> axis.Date(1, at=seq(as.Date("2001/1/1"), max(random.dates)+6,
"weeks"))
>
> Changing the language to "English" will have the same code
produce a graph with English labels.
> On Ubuntu, attempting to change the locale language results in an error
message:
> 'OS reports request to set locale to "Spanish" cannot be
honored'
>
>
> Is there another way of changing the axis labels for dates to a different
language on the fly?
That is the way, but you are not specifying the language (really locale)
correctly. See the R manuals,
e.g.http://cran.r-project.org/doc/manuals/R-admin.html#Locales-under-Linux .
For me,
Sys.setlocale("LC_TIME", "es_ES.UTF-8")
appears to work.
There are international standards for this kind of thing: and then there
is Windows ....
>
> Regards
> Mikkel
--
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