On Thu, 12 Jun 2008, Peter Dalgaard wrote:

Paul Johnson wrote:
In R version 2.7.0 (2008-04-22) as.numeric(".") returns zero.
as.numeric(".")
[1] 0

This must be a bug. Splus and previous versions of R (<= 2.6.0) return NA,
as you might expect.

Depends who is doing the expecting. Americans think '.9' is a number, and everyone thinks '3.' is, so you can leave out numbers before or after the decimal point and have them taken as zero. And POSIX's description of strtod does imply that '.' represents '0.0'.

Note that in (AFAIK) 'Splus' and previous versions of R this depended on the OS, and OSes were not consistent as to what was a number.

I'm running R version 2.7.0 (2008-04-22) on Windows XP.

I suspect that this got fixed along with the "lone sign" issue. I have

Yes, changed (there is no unanimity as to what the rules should be). The R rule now is that you must have at least one digit in a number (not counting the exponent, if there is one).

R version 2.7.0 Patched (2008-06-12 r45900)
Copyright (C) 2008 The R Foundation for Statistical Computing

as.numeric(".")
[1] NA
Warning message:
NAs introduced by coercion

--
Brian D. Ripley,                  [EMAIL PROTECTED]
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

______________________________________________
R-help@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.

Reply via email to