[Rd] (PR#7942) extra spaces before imag part when printing complex numbers

cyril.humbert@univ-mlv.fr cyril.humbert at univ-mlv.fr
Wed Jun 15 18:51:21 CEST 2005


Prof Brian Ripley wrote:
> This is intentional: it aligns the numbers.  E.g.
> 
> >options(width=12)
> >print(c(1+1i, 1-10i, 1+100i))
> [1] 1+  1i
> [2] 1- 10i
> [3] 1+100i
> 
> Neat, eh?
> 
> What made you think this was a bug?


Ah ok, I've misunderstood this feature probably perhaps
because, at first sight, I found the display looks "strange"
when some of the numbers have large imaginary parts as it
tends to make the delimitation between columns of numbers
less visible. E.g.,

> options(width=80)
> print(rep(c(1+1i, 1-1i, 1+1000i), 8))

And if there's less than a line of numbers I find it's
more natural to write :

>  print(c(1+1i, 1-1i, 1+1000i))
[1] 1+1i 1-1i 1+1000i

instead of what is actually printed :
[1] 1+   1i 1-   1i 1+1000i


Anyway, sorry this "bug" report.



> On Wed, 15 Jun 2005 cyril.humbert at univ-mlv.fr wrote:
> 
> >Hello,
> >
> >When printing sequence of complex numbers, extra spaces
> >are sometimes printed between real and imaginary part of
> >each number.
> >
> >For example:
> >## R Version 2.1.1 beta (2005-06-13) [Debian unstable, i386]
> >## and R Version 2.1.0               [Debian unstable, i386]
> >
> >>print(c(1+1i, 10+1i, 100+1i)) # Ok
> >[1]   1+1i  10+1i 100+1i
> >
> >>print(c(1+1i, 1-10i, 1+100i))
> >[1] 1+  1i 1- 10i 1+100i
> >     ^^     ^
> > (extra spaces)

-- 
Cyril



More information about the R-devel mailing list