[R] Locale problem with umlauts in factor levels in 2.7.0 (patched) from grid or lattice

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri May 2 09:02:39 CEST 2008


The bug is in grid, in some layout calculations which need the string 
width.  There was a 'FIXME' in the sources, and I've fixed this now. (svn 
r45579/80).  Many other grid examples worked so it took me a while to 
track this down.

On Thu, 1 May 2008, Dieter Menne wrote:

> With 2.7.0 patched (not tested with 2.0.0), I get an error message in a
> program that ran correctly in R 2.6.2 when the grouping factor of a
> stripplot contains an Umlaut:
> I am aware that there are a few locale-changes in R 2.7.0, but I could not
> easily
> locate who's at fault
>
> Dieter
>
>
> library(lattice)
> dt = data.frame(x=rnorm(100),y=1:100,levs= as.factor(c("Gru","Grü")))
> stripplot(x ~ y|levs, data = dt)
> #Error in grid.Call.graphics("L_text", as.graphicsAnnot(x$label), x$x,  :
> #  invalid input 'Grü' in 'utf8towcs'
>> # Works
> as.graphicsAnnot(as.factor(c("Gru","Grü")))
>
>
>
> R version 2.7.0 Patched (2008-04-30 r45572)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;
> LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] lattice_0.17-6
>
> loaded via a namespace (and not attached):
> [1] grid_2.7.0
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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