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

Peter Wilkinson pwilkinson at
Tue Jun 22 23:13:29 CEST 2004

Actually .... I was not clear .... I will rephrase

I read what is posted below in the help file already ... I read them often.

****I want to keep the row references****

My question is _when you keep the row names_, why is the command 
write.table implemented in such a way that the column names are left 
shifted starting in the column where the row names are written?  Does it 
not make sense to have the column names where they are supposed to be, 
starting in the second column, if the column names _are_ included in the 
first column?Is there a feature in this that I am missing; why is it 
implemented in this way?


At 04:00 PM 6/22/2004, Prof Brian Ripley wrote:
> 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
>Professor of Applied Statistics,
>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