[R] write.table when keeping column headers (names of Columns in matrix) and row numbers

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jun 22 22:00:03 CEST 2004

>From the details of ?write.table  (and in the Data Import/Export manual 
and in MASS4 ...)

     Normally there is no column name for a column of row names.  If
     'col.names=NA' a blank column name is added.  This can be used to
     write CSV files for input to spreadsheets.

What can we possible do to make this more obvious?

On Tue, 22 Jun 2004, Peter Wilkinson wrote:

> When using the write.table (say for a tab delimited file) command on a 
> matrix with Row and Columns, the column headers are always being left 
> shifted into the column where the row numbers are being placed. One can see 
> this when you open up the tab delimited file in excel.
> Is there a better command for this, or is this supposed to be a 'feature'.

It is a genuinely useful feature, fully documented.

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

More information about the R-help mailing list