[Rd] (PR#8337) formatC adds leading space -- on some Windoze
maechler@stat.math.ethz.ch
maechler at stat.math.ethz.ch
Tue Nov 22 08:54:12 CET 2005
>>>>> "KevinW" == Kevin Wright <kwright68 at gmail.com>
>>>>> on Mon, 21 Nov 2005 18:13:36 +0100 (CET) writes:
KevinW> Full_Name: Kevin Wright
KevinW> Version: 2.2.0
KevinW> OS: Windows 2000
^^^^^^^
this must be part of the problem
KevinW> Submission from: (NULL) (170.54.58.4)
KevinW> Apologies if my expectations (or reading of the man page) are incorrect.
KevinW> I seem unable to left-justify exponential format
KevinW> numbers. There appears to always be an extra space
KevinW> inserted to the left.
KevinW> Using the example from the formatC help page:
R> xx <- pi * 10^(-5:4)
R> cbind(formatC(xx, wid = 9, flag = "-"))
KevinW> [,1]
KevinW> [1,] " 3.142e-05"
KevinW> [2,] "0.0003142"
KevinW> [3,] "0.003142 "
KevinW> [4,] "0.03142 "
KevinW> [5,] "0.3142 "
KevinW> [6,] "3.142 "
KevinW> [7,] "31.42 "
KevinW> [8,] "314.2 "
KevinW> [9,] "3142 "
KevinW> [10,] " 3.142e+04"
which is also not obeying the 'wid' argument.
I get something much more reasonable:
[,1]
[1,] "3.142e-05"
[2,] "0.0003142"
[3,] "0.003142 "
[4,] "0.03142 "
[5,] "0.3142 "
[6,] "3.142 "
[7,] "31.42 "
[8,] "314.2 "
[9,] "3142 "
[10,] "3.142e+04"
formatC uses your system's C library printf {that's where the
"C" comes from in 'formatC'} which seems to be
broken or at least not performing as we think it should.
On a "Windows 2003 Server" I have access to, I see the same
wrong behavior as above.
Martin Maechler, ETH Zurich
More information about the R-devel
mailing list