[Rd] print.data.frame(), wrong column names alignement, UTF-8 names (PR#7803)

cyril.humbert at univ-mlv.fr cyril.humbert at univ-mlv.fr
Thu Apr 21 14:08:19 CEST 2005


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=fr_FR.UTF-8 at euro;LC_NUMERIC=C;LC_TIME=fr_FR.UTF-8 at euro;LC_COLLATE=fr_FR.UTF-8 at euro;LC_MONETARY=fr_FR.UTF-8 at euro;LC_MESSAGES=fr_FR.UTF-8 at euro;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C"

> print (data.frame(aaaa=1, b=2, c=3)) # (ok)
  aaaa b c
1    1 2 3


> print (data.frame(éééé=1, b=2, c=3)) # (extra blanks)
  éééé 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 = FALSE).

Thanks,
Cyril


--please do not edit the information below--

Version:
 platform = i386-pc-linux-gnu
 arch = i386
 os = linux-gnu
 system = i386, linux-gnu
 status = 
 major = 2
 minor = 1.0
 year = 2005
 month = 04
 day = 18
 language = R

Search Path:
 .GlobalEnv, package:methods, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, Autoloads, package:base



More information about the R-devel mailing list