From p.dalgaard at biostat.ku.dk  Mon Apr 18 15:14:43 2005
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Mon Apr 18 15:16:50 2005
Subject: [Rd] RFC: hexadecimal constants and decimal points
In-Reply-To: <16995.35564.89801.678206@stat.math.ethz.ch>
References: <Pine.LNX.4.61.0504171136210.13254@gannet.stats>
	<16995.35564.89801.678206@stat.math.ethz.ch>
Message-ID: <x2ll7gtef0.fsf@biostat.ku.dk>

Martin Maechler <maechler@stat.math.ethz.ch> writes:

>     BDR> We could do better by insisting that "." was the decimal
>     BDR> point in all interval conversions _to_ numeric. Then the
>     BDR> effect of setting LC_NUMERIC would primarily be on
>     BDR> conversions _from_ numeric, especially printing and
>     BDR> graphical output. (One issue would be what to do with
>     BDR> scan(), which has a `dec' argument but is implemented
>     BDR> assuming LC_NUMERIC=C. I would hope to continue to have
>     BDR> `dec' but perhaps with a locale-dependent default.) The
>     BDR> resulting asymmetry (R would not be able to parse its own
>     BDR> output) would be unhappy, but seems inevitable. (This could
>     BDR> be implemented easily by having a `dec' arg to EncodeReal
>     BDR> and EncodeComplex, and using LC_NUMERIC to control that
>     BDR> rather than actually setting the local category. For
>     BDR> example, deparsing needs to be done in LC_NUMERIC=C.)
> 
> Yes, I like this quite a bit:
> 
>  -  Only allow "." as decimal point in conversions to numeric.
> 
>  -  Allowing "," (or other locale settings if there are) for
>     conversions _from_ numeric will be very attractive to some
>     (not to me) and will make the use of R's ``reporting
>     facility' much more natural to them. 
> 
>   That the asymmetry is bit unhappy -- and that will be a good reason
>   to advocate (to the user community) that using "," for decimal
>   point may be a bad idea in general.

Could I suggest that we tread very carefully here? This issue has
caused several trip-ups historically:

- The locale-dependent "comma-separated variables" format, in some
  cases not separated by commas. And it seems that you can still get
  Excel files that use comma both for separation and as decimal point
  (I thought that problem disappeared with early versions of Paradox,
  but apparently not, according to a resent query on r-help).

- Exports from SAS as a text file cannot be read by SPSS and vice
  versa.

etc. Quite possibly, the "computer world" missed the opportunity to
agree on an international standard (what's the big deal with using
commas anyway?). As it is we probably have to adjust to it, but we
have to distinguish very carefully between reports, code, and data,
and choose appropriate conventions for each case.


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] RFC: hexadecimal constants and decimal points
Peter Dalgaard