[R] as.numeric(".1") + SessionInfo
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Jan 24 18:56:19 CET 2007
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.)
On Wed, 24 Jan 2007, NOEL Yvonnick wrote:
>> >> as.numeric(",1")
>> NOEL> [1] 0,1
>> Instead of the output below, can you please give the full
>>
>> sessionInfo()
>>
>> output?
>
>
> Here it is:
>
> R version 2.4.0 (2006-10-03)
> i686-pc-linux-gnu
>
> locale:
> fr_FR.UTF-8
>
> attached base packages:
> [1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
> [7] "base"
>
> other attached packages:
> lattice cairoDevice gWidgetsRGtk2 RGtk2 gWidgets
> "0.14-16" "1.2" "0.0-9" "2.8.6" "0.0-11"
>
> Yvonnick Noel, PhD.
> Dpt of Psychology
> U. of Rennes
> France
>
> ______________________________________________
> 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
> 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