Re: [R] as.numeric(".1") under RGtk2

From: Michael Lawrence <lawremi_at_iastate.edu>
Date: Thu 25 Jan 2007 - 02:38:55 GMT

This seems to be a conflict between GTK+ and R. Apparently, GTK+ sets the locale by itself. There is a way to prevent GTK+ from doing that. I will release a hotfix for RGtk2 soon and we'll see if it fixes it. I just need to run gtk_disable_setlocale() before gtk_init_check().

Thanks for reporting this,
Michael

On 1/24/07, NOEL Yvonnick <yvonnick.noel@uhb.fr> wrote:
>
> Prof Brian Ripley a écrit :
> > I can reproduce this via
> >
> >> Sys.setlocale("LC_NUMERIC", "fr_FR")
> > [1] "fr_FR"
> > Warning message:
> > setting 'LC_NUMERIC' may cause R to function strangely in:
> > setlocale(category, locale)
> >> as.numeric(",1")
> > [1] 0,1
> >> as.numeric(".1")
> > [1] NA
> > Warning message:
> > NAs introduced by coercion
> >
> > Assuming you have not done that anywhere, it should not happen. If you
> > have, you were warned. (Have you tried starting R with --vanilla to be
> > sure?)
> >
> > as.numeric() is using strtod which should only be affected by the locale
> > category LC_NUMERIC, and R itself does not set LC_NUMERIC. So either
> > you or some rogue OS function must have, unless there is a pretty major
> > bug in the OS. (Just using a UTF-8 fr_FR locale does not do it on
> > either of the Linux variants I tried.)
>
> Thanks for these helpful indications. This seems to be related to the
> RGtk2 package :
>
> # Before loading RGtk2
> > as.numeric(".1")
> [1] 0.1
> > as.numeric(",1")
> [1] NA
> Warning message:
> NAs introduits lors de la conversion automatique
> # After library loading
> > library("RGtk2")
> > as.numeric(".1")
> [1] NA
> Warning message:
> NAs introduits lors de la conversion automatique
> > as.numeric(",1")
> [1] 0,1
>
> I send a copy of this post to the RGtk2 package maintainers.
>
> Thanks for your help,
>
> Yvonnick Noel, PhD.
> Dpt of Psychology
> U. of Rennes
> France
>

        [[alternative HTML version deleted]]



R-help@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 and provide commented, minimal, self-contained, reproducible code. Received on Thu Jan 25 18:36:53 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 25 Jan 2007 - 08:30:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.