(PR#7803) [Rd] print.data.frame(), wrong column names alignement,
ripley at stats.ox.ac.uk
ripley at stats.ox.ac.uk
Wed Apr 27 22:18:24 CEST 2005
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
--27464147-733928972-1114633091=:27258
Content-Type: TEXT/PLAIN; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE
I've managed to solve this, but the major problem I had was not R but that=
=20
printf was not respecting multi-byte characters in its field widths in
Fedora Core 3. It is clear from the C99 standard that field widths are in=
=20
characters not bytes. This may occur elsewhere.
Similarly, double-width characters in e.g. Chinese will not be accounted=20
for.
On Thu, 21 Apr 2005 cyril.humbert at univ-mlv.fr wrote:
> Hello,
>
> When a data.frame contains column names with accentued characters
> (UTF8 encoded), the alignement of the column names is wrong (extra
> spaces inserted).
>
> For example : ------------------------------------------------
>
>> Sys.getlocale()
> [1] "LC_CTYPE=3Dfr_FR.UTF-8 at euro;LC_NUMERIC=3DC;LC_TIME=3Dfr_FR.UTF-8 at eur=
o;LC_COLLATE=3Dfr_FR.UTF-8 at euro;LC_MONETARY=3Dfr_FR.UTF-8 at euro;LC_MESSAGES=
=3Dfr_FR.UTF-8 at euro;LC_PAPER=3DC;LC_NAME=3DC;LC_ADDRESS=3DC;LC_TELEPHONE=3D=
C;LC_MEASUREMENT=3DC;LC_IDENTIFICATION=3DC"
>
>> print (data.frame(aaaa=3D1, b=3D2, c=3D3)) # (ok)
> aaaa b c
> 1 1 2 3
>
>
>> print (data.frame(=C3=A9=C3=A9=C3=A9=C3=A9=3D1, b=3D2, c=3D3)) # (extra =
blanks)
> =C3=A9=C3=A9=C3=A9=C3=A9 b c
> 1 1 2 3
>
> --------------------------------------------------------------
>
> This is probably due to fact that the number of white spaces
> to insert between the columns is computed using the length
> of the column names (in bytes) instead of their width (in
> characters), which are different in the example above.
>
> The problem is the same (extra spaces inserted) with
> print.data.frame(..., right =3D FALSE).
>
> Thanks,
> Cyril
>
>
> --please do not edit the information below--
>
> Version:
> platform =3D i386-pc-linux-gnu
> arch =3D i386
> os =3D linux-gnu
> system =3D i386, linux-gnu
> status =3D
> major =3D 2
> minor =3D 1.0
> year =3D 2005
> month =3D 04
> day =3D 18
> language =3D R
>
> Search Path:
> .GlobalEnv, package:methods, package:stats, package:graphics, package:grD=
evices, package:utils, package:datasets, Autoloads, package:base
--=20
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
--27464147-733928972-1114633091=:27258--
More information about the R-devel
mailing list